Eon went back to Code.org's challenge puzzle — the one his dad calls "a lesson designed to stretch your brain" — and this time he wanted to beat it himself. The goal sounds simple: steer a bird across a grid of squares to reach a pig. But the bird only understands compass directions, the squares stretch farther than they look, and one wrong number makes the whole thing fall apart. This video is really about two ideas working together: looping to do less typing, and debugging when the loop is off by just a little.
First, figure out which way is which
Before any blocks go down, Eon and his dad argue about directions. "I think he needs to go forward then turn," Eon says. Then comes the tricky part — keeping north, south, east, west straight. At one point Eon points the wrong way: "South is like this way." "No, S is this. Oh, this east." It takes a second to sort out that east points one way and south points down.
There's a real lesson hiding in that mix-up. A computer doesn't know "that way" or "over there." It only knows exact directions. So the first job in coding a path isn't typing — it's planning: which direction, and how many steps. Eon plans the route out loud ("go north one step, then east, then south") before touching a single block.
The mouse fights him too. He's still new at click-and-drag, and the blocks won't snap where he wants. "You need to left click, not—" his dad starts. "Okay, I think you just click and drag." Wrestling the tool is part of learning; even the plan being right doesn't help if the block lands in the wrong spot.
The "machine" that repeats
Here's the big idea. Eon needs the bird to go east several times, and stacking east, east, east by hand is slow. So his dad introduces the repeat block — except Eon keeps calling it "the machine." His dad rolls with it: "Okay, it's machine. Doesn't really matter." (In real code it's called a loop.)
A repeat block runs the moves inside it over and over. Set it to repeat 3 times and the moves inside it happen three times — from just one block.
But the first try doesn't work, and that surprises Eon. He sets it to repeat east three times and runs it — "still you didn't reach." The catch: going east alone won't get there. The path also needs a north before and a south after. So the real solution wraps only the repeated part in the machine:
- move north
- repeat 3 times: move east
- move south
Four lines, challenge complete, high five. Then Eon clicks "show code" to see what the blocks really wrote — something like move north, for count from zero while less than three, move east, then move south. The colorful blocks were real code the whole time.
Find a landmark, then squash the bug
A later puzzle puts the pig far across a wide field of identical grass squares. Counting blank grass is almost impossible. So his dad teaches a pro trick: find a reference. "If you look at the side, like the TNT — you want to find a reference." Lining up against a landmark beats guessing in open space.
Eon wraps north and east in the machine and sets it to repeat 3 times. Runs it. The bird stops short — and the pig looks upset. "Is the pig crying?" Eon asks. His dad reads it like a programmer: "Maybe that means the repetition is not correct. We need to do that one more time." The loop ran one time too few.
The fix is small and exact: "three add one is four." Bump the repeat from 3 to 4, reset, run again — and the bird reaches the pig. That tiny miss is so common that programmers have a name for it: an off-by-one bug. Eon also pokes at the Step button to see the difference from Run: Run does everything at once, while Step walks through one block at a time so you can watch exactly where it goes wrong.
Try it
Set up two stacks of the same move — for example, four "east" blocks in a row. First, count them by hand: one, two, three, four. Now imagine wrapping them in a repeat 4 times block instead. Then play "off-by-one detective": if a friend sets the repeat to 3 but the goal needs 4 steps, will the character land short or overshoot? (Short!) And what's the fix? (Three add one is four — just like Eon did.) Whenever you catch yourself writing the same block again and again, that's a loop waiting to happen.
