The Not Block
On each map, a bone lies somewhere on the path, and the path goes on past it. Right where the bone lies, a side path leads off to the left, to the goal. The dog has to walk to the bone, stop on it and pick it up, and then go down the side path. The bone is in a different place on each map, so no number of steps fits them all. And Repeat while path ahead would take the dog past the bone, to the end of the path.
The dog should walk as long as there's no bone under it. That's what the new not block is for. It's hexagonal like the senses, and it has a hexagonal slot of its own, for another condition. It turns that condition's answer around: not bone here is true where there's no bone, and false where there is one. Turning a condition around like this is called negation.
Put bone here into not, and not into the slot of Repeat while:
Repeat whilenotbone hereMove forward
Before every pass, the dog checks the condition: is it true that there's no bone here? While it is, the dog takes a step. As soon as it stands on the bone, the condition is false, the loop ends, and the program goes on with the blocks under the loop. So you can read the loop as "walk until there's a bone". Like any condition, not fits into every hexagonal slot, so it works in an If too. This time, though, there's no If among the blocks: a loop is enough.
You've been using such a loop for a while. Repeat until at the goal repeats its blocks while the dog is not at the goal. Python, JavaScript and many other programming languages have no Repeat until loop, only Repeat while, so that's how a programmer writes it there: repeat while not at the goal.
Instructions
- 1
On all three maps, walk the dog to the bone with
Repeat whilenotbone here, and pick the bone up. - 2
Then turn left and walk down the side path to the goal.