Learn how to write your own code like a computer programmer!
Coding is writing a set of instructions for a computer to follow to make sure that it performs actions the way that we want them to! The instructions will create the same endpoint every time the computer encounters that same scenario. It’s like a recipe for computers! We are going to create our first code to help a robot navigate a maze.
First, print out the Maze Grid and Coding Cards, and find (or make) a figure to serve as your robot.
To create your maze, mark one box on your Maze Grid ‘Start’ and another ‘End’, these will be the starting point and the end goal of your code. Begin shading in boxes on your grid until you have a winding maze; make sure that there is a path that connects your Start and End! You can use any building blocks to create walls on your shaded boxes to create a 3D maze.
Cut out your coding cards. These are the building blocks of your code. You will build your code to get your robot through the maze. Plan your route ahead of time and start by using the ‘Move Forward’, ‘Turn Left’, and ‘Turn Right’ cards to get through the maze. Once you have laid out the coding cards, ‘Run’ your code by following each card’s instructions. If you have reached the ‘End’, then you have successfully created your first code!
Now it is time to add another card! Try solving a new maze by adding the ‘Repeat’ cards. This will allow you to use fewer cards in your code by repeating the instruction under it a certain number of times. What is the fewest number of cards you can use in your code?
Congratulations! You just learned the basics to coding like a computer programmer! Keep working with these cards and new mazes, or hop on the computer and start working with a free coding program to learn more!
SarahRose Adan is the Spark!Lab Coordinator at the Springfield Science Museum. She can be reached at email@example.com.