Thursday, April 23, 2015

Program with Paper: A-Maze Your Friends with a Hand-Written Computer Program

Learn more about how computer programs work by writing one yourself—to solve a maze of your own creation!

April 23, 2015 | and |

Can you help a friend solve a maze? By writing complete instructions, you'll get a peek into the world of computer programming. You don't even need a computer to try this amazing activity!

Key conceptsComputer programming Introduction Background  Materials

  • Graph paper
  • Ruler
  • Pencil
  • Volunteer
 Preparation
  • Use a sheet of graph paper to create a small maze that fits on a rectangular grid. All of the maze's walls should be vertical or horizontal—no diagonal or curved lines.
  • Start out with a small, easy-to-solve maze. (You can make a more difficult one later.)
  • Make sure the maze has clearly labeled "start" and "finish" points.
 Procedure
  • Imagine that you are a person walking through your maze, starting at the "start" point. On a separate piece of paper write directions, one step at a time, for how you would walk through the maze. For example, use commands like "move forward two squares," "turn left" and "turn right." Continue writing directions until you have enough to reach the maze’s "finish" mark.
  • Optional: If you prefer, you can draw arrows for your directional instructions instead of writing out the words.
  • Now, hand your maze, the directions and a pencil over to your volunteer. Instruct them to follow your directions as they go through the maze, . They are not allowed to solve the maze on their own or change the directions.
  • Watch closely to see if the volunteer successfully completes the maze by following your directions.
  • If your volunteer made it all the way to the finish line, then congratulations! Your program did not have any bugs. Try making a bigger, more complicated maze and start over.
  • If your volunteer crashed into one of the maze's walls, however, you need to debug your program! Carefully trace through your program step by step to see where things went wrong. Did you tell them to move one block too far or turn one block too early? Just mistake can throw off your entire program and cause a crash later on, so look carefully!
  • After you discover the bug, rewrite your program. If you only need to change one or two steps, you can just erase them instead of rewriting the whole thing.
  • Have your volunteer try the maze again, following your new program. Did they solve it this time? If not, keep debugging your program until they solve the maze.
  • Extra: Computer programs are written in many different "languages," which all have slightly different formats but very similar underlying concepts. For example, some computer programs use punctuation and spelling differently—this is called the program's "syntax For example, what about using commands that are defined relative to directions on the piece of paper like "move up," "move down," "move left" and "move right;" as opposed to turning left or right as if you were a person standing in the maze?
  • Extra: If you can no longer rely on a rectangular grid for movement, how would you write the program?
  • Extra: Instead of using a maze on paper, write a program to navigate a person walking through your house or school.

Observations and results  More to exploreScience Activities for All Ages!, from Science BuddiesScratcha kid-friendly way to learn to program from Massachusetts Institute of TechnologyComputer Science Project Ideas, from Science Buddies

Science Buddies

No comments:

Post a Comment