The starting block below is CODE_PARENT
units long. Use the tools to the right to convert the starting block into the goal block that is CODE_OFFSPRING
units long. You can see your progress as the current block.
Starting Block:
Current Block:
Goal Block:
The starting block of length CODE_PARENT
units
can be rewritten as fraction( N_PARENT_EXPANDED, D )
.
The goal block of length CODE_OFFSPRING
units
can be rewritten as fraction( N_OFFSPRING_EXPANDED, D )
.
Cutting the starting block into x
pieces is the same as dividing it by x
.
Therefore cutting the starting block into N_PARENT_EXPANDED
pieces is the same as:
\dfrac{N_PARENT_EXPANDED}{D} รท N_PARENT_EXPANDED =
\dfrac{N_PARENT_EXPANDED}{D} \cdot \dfrac{1}{N_PARENT_EXPANDED} = \dfrac{1}{D}
Copying the resulting block y
times is the same as multiplying it by y
.
Therefore copying the resulting block N_OFFSPRING_EXPANDED
times is the same as:
\dfrac{1}{D} \cdot N_OFFSPRING_EXPANDED = \dfrac{N_OFFSPRING_EXPANDED}{D}
Notice that we end up with a block the same size as the goal block.
Therefore the solution is to cut the starting block into N_PARENT_EXPANDED
pieces and copy the resulting block N_OFFSPRING_EXPANDED
times.