These 16 coding puzzles take children from zero to high school-level programming

A lesson sequence using the boardgame Robot Turtles

Ben Wheeler
Robot Owl

--

Some examples of Robot Turtles puzzles, each of which introduces a new idea.

Part 2 of 2: Puzzles

[Go to Part 1: Overview]

This is part two of my introduction to the board game Robot Turtles, the best — and most fun — tool I know of to get kids programming without a screen.

Here are 16 puzzles I designed to take students from no knowledge, to mastery of the game’s programming concepts.

This article originally ran in Robot Owl, a newsletter for parents and teachers who want to spark a passion in any child for curiosity and innovation. Subscribe here.

What is a Robot Turtles puzzle?

A simple Robot Turtles puzzle in progress

Before each game of Robot Turtles, you’ll need to set up a “puzzle” — an initial board layout that puts obstacles between the robot and its goal, the jewel.

Puzzles can vary from short and simple to long and complex, and can involve a variety of different obstacles, or patterns that lead the player to discover particular solutions.

Obstacle types

There are three obstacle types:

  • walls: turtles can’t move through walls. If they try, they just bump it and stay where they are.
  • ice walls: like regular walls, but they can be melted with a laser blast (kids love blasting these!)
  • boxes: movable! Pushing forward against these moves them forward, as long as there is space behind them. Several in a row can be pushed.

How to find and create puzzles

As I explained in part one, Robot Turtles does not come with pre-existing puzzles.

There are several sources of puzzles:

  1. Teachers and parents make up puzzles on the spot, in response to how kids did on the last puzzle
  2. Kids start making up puzzles for themselves. This is great, but there are types of challenges they won’t anticipate.
  3. The publisher provides a small library of examples on their website, but with no clear sequence.
  4. You can use my puzzles here as a jumping off point.

Tip: as you identify or design puzzles you like, snap a photo of them to make it easy to set up in the future.

Trying out an algorithm

What makes a good Robot Turtles puzzle?

Pacing: As every teacher knows, learning requires a steady progression of challenge — too hard and the problems seem impossible, too easy and the problems seem tedious. Good puzzles repeat ideas so learners gain mastery and confidence, but also slowly push learners to adapt to increasing complexity.

Clarity: when introducing new ideas, try to find the simplest possible puzzle that requires that idea to be used.

Brevity: the Robot Turtles board is large; you can make puzzles that are plenty long and complex on a quarter of the board. Try to keep puzzle solutions under 10 or 20 cards.

Progression of concepts: some concepts depend on others, and some benefit from being set up using puzzles that show why the new idea is needed.

Computer science concepts

Robot Turtles seems simple on the surface, but it actually supports exploration of many core computer science concepts.

sequence, procedure, algorithm: these all mean a series of steps in a program. They don’t need to be actual computer code. The emphasis is on strictly executing each step in turn, whether it’s a sequence of steps for tying your shoelaces, or a sequence of commands carried out by a robot.

testing: running your code to compare what it does to what you want it to do. Programmers are constantly testing their code.

debugging: the cycle of coding, testing, coding, testing. All code has “bugs” the first time it’s run — and usually the second, third, and fourth! Big coding projects like Minecraft or the Chrome web browser often discover, and fix, thousands of bugs every year. Finding bugs in their code is the main thing programmers do!

iteration: repeating a sequence of steps. Code iterates, when we tell it to run the same sequence multiple times. And programmers themselves can iterate, in the cycle of debugging. All programs, from Mario to spaceship navigation, are created through iteration; they’re never perfect at the start.

loops: loops are how we decide to repeat a sequence of steps. Do we keep iterating forever? Do we iterate a certain number of times? Do we change anything before each iteration to make it different?

functions: a sequence of steps that we name, so we can reuse the sequence whenever we want. To run the sequence, we “call” the function. In Robot Turtles, we use the “Function Frog” card to call a sequence of cards.

recursion: when a function calls itself. If the last step of our function is the Function Frog card itself, then the sequence will call itself, and keep calling itself forever! There are examples of recursion in everyday life: “The Song that Never Ends” is one example; another is when you stand in between two mirrors and each mirror reflects a mirror which reflects a mirror which reflects a mirror…

In the puzzles below, I’ll mention these concepts as they come into play.

Introductory puzzles

These puzzles are designed to introduce the mechanics of the game to new players.

For each puzzle, ask yourself what series of steps would be necessary for the robot to reach the jewel.

1. “Left turn or right turn?”

What sequence of steps — forward, turn left, turn right — would get this robot turtle to the same space as the jewel?

Concept: imagine you are the turtle. Would you need to turn to your right or your left?

I find this is a very challenging concept for children to grasp at first. It helps to have them literally stand up and mimic the position and movements of the turtle.

(Note that the turtle has a yellow flower to its left and a purple flower to its right; that can be a reference point, to demonstrate that whichever way the turtle is pointed, “turning right” will always make a turn towards the purple flower.)

Below is a solution to puzzle #1. Can you find a different one?

2. “Around the obstacle”

Concept: introduce walls; increase the length of the programs, providing more opportunities for debugging

Here is a solution, to make sure we’re on the same page; I won’t provide solutions for the rest of the puzzles.

3. “Turn around”

Concept: turning twice to the left has the same effect as turning twice to the right. Multiple paths can get the turtle to the jewel.

Ice walls

It’s somehow even more compelling to blast ice walls with lasers in a board game than It would be in a video game.

4. “Introducing ice walls”

Concept: introduce ice walls and the Laser Blast card.

5. “Ice battle”

Concept: you can repeat by blasting, moving, blasting, moving; or, you can blast several times in a row, then moves several times in a row.

Point out that in a program, you can repeat a sequence of steps (like “blast, then move forward”) by using a “loop”, and saying how many times you want the loop to run.

Note that blasting has no effect on regular walls; and blasting the jewel destroys it (this is a rule my students that I like to add, which adds a bit of danger and surprise)

6. “Ice maze”

Concept: working out an especially long sequence. This can be helpful to push learners to be especially careful and precise about anticipating the effect of their program.

Boxes

Boxes seem straightforward at first, but their simple rules make for unexpected complexity.

7. “Introducing boxes”

Concept: a box can be pushed by the turtle; it moves forward when the turtle pushes forward against it, but stays put if the turtle turns next to it or moves away from it.

8. “Tricky boxes”

Concept: the way boxes move has unexpected consequences. what happens if you try to get to the jewel by moving the box to the right?

9. “Box strategy”

Concept: multiple boxes in a row can be pushed by the turtle. What happens if you push the boxes all the way up?

Function Frog

10. “Introducing Function Frog”

Concept: Create a sequence to get to the jewel. What pattern do you notice in your solution? If you could take just a few of your cards and repeat that sequence over and over, which cards would you use?

Put this sequence together on the side, and use the Function Frog card to “call” it. How many times do you need to call Function Frog?

11. “Laser repetition”

Concept: How does adding ice walls change the function sequence that you repeat?

12. “Move first or blast first?”

Concept: Create a function that you can call four times to reach the jewel. Follow the rule that being hit with a Laser Blast will destroy the jewel.

Does the function work correctly if the first card is a Laser Blast? What if the first card is a move forward?

13. “Save the jewel”

Concept: Create a function that you can call four times to reach the jewel. Follow the rule that being hit with a Laser Blast will destroy the jewel.

How can you avoid destroying the jewel? Hint: your function can include moves that usually have no effect, like bumping into walls!

14. “Inconsistent ice”

Concept: Now the ice walls are not in a consistent pattern. Can you create a function that will work correctly, no matter where the ice walls are?

15. “Mid-course adjustment”

Concept: A simple function, repeated three times, can get you halfway to the jewel. Now get from there to the jewel.

What adjustment would you have to make in the middle, between calls to the Function Frog, to be able to avoid repeating yourself in your code?

16. “Recursion”

Concept: Go back to a simple puzzle that can be solved using Function Frog. What would happen if you added one more step to your function, by having it call Function Frog, itself?

How many times would you need to call Function Frog in your main program?

A note about “obnoxious code”

If you play Robot Turtles with a large group of kids, I guarantee that sooner or later, some of them will start mischievously trying long, random sequences of cards.

I think of these as “obnoxious code” — sequences intended to be completely wrong, and annoying to even try out.

What’s important to realize is that “obnoxious code” actually has a long and rich history in computer science. Programmers love to test the extreme limits of the systems they’re confined by; it’s both fun and actually very useful, because the limits help you understand how the system works.

I encourage you to do what a computer does: take the code that you’re programmed with seriously, and executed step-by-step, no matter what it says.

Final thoughts: it’s not genius, it’s programming

Many teachers and parents balk at exploring programming with their kids because they aren’t sure where to begin, and aren’t sure of their own abilities.

Robot Turtles is an excellent place to start on both counts. It’s incredibly easy to get started, it’s colorful and fun, and there’s no trick to doing the programming: you make a sequence of cards, carry them out one at a time, and see what happens.

If you find yourself not sure about a solution, that’s good! Kids get to see that programming doesn’t work through genius or magic, but just through iterative development: writing programs, running them, watching them go horribly wrong, making a change, and running them again.

A tribute to Papert, created in Scratch, a kids’ programming platform that was inspired by Papert, Solomon and Feurzeig’s Logo language

Seymour Papert, one of the creators of the Logo programming language that taught a generation of students — including me — to code, believed that this was the greatest power that came from learning to program. He saw children who had thought of themselves as “not smart” or “not good at math” transform their understanding of themselves as learners after seeing debugging celebrated as the central activity of computer programming.

Robot Turtles teaches core computer science principles, elegantly. But more importantly, it can help us understand that when our efforts aren’t working, the problem isn’t with us — we just need to debug our algorithm!

This was lovingly written by Ben Wheeler in Brooklyn, NY. If you like it and want to get his subscriber-only articles in your inbox, please subscribe at robotowl.co !

--

--