Have you ever wondered how computers know what to do? Today we’re going to learn this plus the basics of coding by playing a tricky maze game!
MATERIALS:
Deck of cards
A coin
Small squares of paper, or some other small objects for playing pieces (one for each player)
Paper to write on
Pencil
Markers
TIME ESTIMATED:
20 minutes
DIRECTIONS:
First, lay the playing cards face down to create a grid. This will be your board.
Color the small piece of paper a unique color so it can be your playing piece.
Place the coin on the card that will be the “finish line”, and place your pieces on the starting card.
Make a maze by flipping over a few cards to act as obstacles. Be sure you still have a way to get to the finish line!
Now, we’re going to make a set of instructions for our pieces to get them to the finish line. Write down how many spaces left, right, up, or down you want your piece to move and in the correct order!
One at a time, move your pieces using the instructions on your paper. If you run into any obstacles, look at your instructions and try to fix the mistake!
After you’ve reached the finish line or time has run out, look over your final instruction list and see how many moves you’ve made.
Think Like a Scientist!
Do you think you could’ve gotten your piece to the finish line in fewer moves?
Can you think of any other things that take instructions like this?
HOW DOES IT WORK?
In this activity, we learned the basics of coding and used a set of instructions to solve a problem! Our pieces could only follow the instructions we gave them before they started moving. When we code, we are basically giving the computer a set of instructions to do a certain job. Each instruction is called a command, the whole set of instructions is called an algorithm, and when we give these instructions to a computer, we call it a program.
Once we run the code, the computer will do whatever we tell it, even if this means running into an obstacle like our pieces did! When this happens, we have to go back to the instructions we made, find the mistake, and fix it. We call the mistake a bug and the process of fixing it debugging, which is one of the biggest parts of coding! As you can see with our maze, it’s not always easy knowing what the right moves are until we try things out.
Another important part of coding is the time it takes to do a job. For example, we can solve our maze in different amounts of time depending on the number of moves we make. Most of the time, we want our code to do the job as quickly as possible so we can move on to other things. This can mean giving it fewer instructions, or fewer moves for our pieces to make.
Further exploration:
People use code to do many different things. Our cell phones need it to work, games and apps are built using it, rockets are designed and tested with it, robots rely on it to function, and so much more! Programmers are people who design code meant to be used by computers to do certain jobs, called software. Every time we log on to our computers and watch our favorite videos, play our favorite games, or even just browse the web, we're using the code (or software) a programmer designed!
Looking for more fun at-home STEM activities for your young scientist? Check out our workbook full of exciting science experiments and empowering activities!
Learn more and purchase today!