A Bone on Every Tile
This time, there's a bone on every tile of the path. The dog has to do the same thing for each bone: walk onto it and pick it up. That's a pattern that belongs in a loop.
Inside a loop, the order of the blocks matters just as anywhere else. Try going through the first pass in your head:
- If the loop has
Move forwardfirst and thenPick up bone, the dog steps onto the first bone and picks it up. The second pass takes it to the second bone, and so on. - If
Pick up bonecomes first, the dog tries to pick up a bone where it stands at the start. But there's none there.
Going through the first and the last pass of a loop in your head is a good habit. The beginning and the end of a loop are where bugs hide most often.
Instructions
Pick up all six bones.
Walk to the goal.
Use at most 4 blocks.
Start programming for free
5/8