Cross-Curricular Connections: Exploring the "Maze Game" Unit
Aug 22, 2024With ever-changing technology leading to the creation of intricate games and activities, completing something like a simple maze may not be a child’s first choice. But did you know there are actually many benefits that result from playing this basic game?
Mazes help develop problem-solving skills, as they require students to break the maze into smaller, more manageable parts in order to solve the larger challenge. Students also develop organizational and planning skills, as they must map out their route and follow their plan in an organized way. Enhancing memory and spatial awareness skills, and encouraging creativity are among additional benefits that come from solving mazes.
Add the challenge of coding (rather than solving) a maze, and these skills compound. Maze Game is a submodule that is part of the larger “Let’s Play It Junior” module in Content Library Junior. This submodule explores basic programming concepts, like using loops and conditionals, combined with other content area skills and problem-solving skills. What’s more is this submodule teaches students to actually draw the maze for their program using instructions from the Pen Extension in Scratch.
Programming Concepts in Maze Game
If you’ve been reading our Cross-Curricular Connection segments, you’re probably already familiar with the programming concepts we’re about to discuss. But if you’re new here, we will cover some basic concepts that are applied throughout Maze Game and many other Content Library Junior projects.
The first is the concept of conditionals, or what we often refer to as the “if-then” statements in programming. IF a certain situation is true, THEN the program executes instructions that follow.
When drawing a maze using the Pen Extension, the walls of the maze are drawn in different colors. In a typical maze game, the player is not supposed to pass or touch the walls of the maze. We teach students how to write the program so that if the user does touch any part of the wall and/or any other obstacles that might be part of the course, then they’re brought back to their starting position. We also use conditional statements to say “Great job!” once the player has reached the finish box, which is drawn in a different color from the maze walls. So simply, IF the user hits the maze wall or an obstacle, THEN the user is sent back to the start. IF the user completes the maze successfully, THEN the program says “Great job!” Conditionals are needed in most programs, so understanding the purpose of the different types of loops, as well as when and how to use them, is incredibly important not just for this subunit but for many coding projects students might attempt to tackle.
The second is the concept of loops, which are instructions we use to repeat the code. There are a few different ways in which a programmer might want to repeat the code, such as for a certain period of time or indefinitely. While loops execute a block of code until certain conditions are met, for loops execute a block of code for a certain number of interactions, and forever loops make it so the code runs continuously. When writing block code using Scratch, there are color coded categories on the left hand side of the screen. One of these categories, the Control category, includes instructions for these different types of loops.
The forever instruction in the Control category creates a forever loop. In this program, the conditionals are placed inside of the forever loop. The conditionals in this program make it possible to create obstacles and to indicate the player has reached the end of the maze successfully. Because the walls of the maze are a certain color, IF the player touches this color, THEN the sprite will be sent back to the starting box. This is possible using a combination of instructions from the Control category and the Sensing category.
Understanding how to code this conditional makes it possible for the programmer to add obstacles, because IF the player touches any of the obstacles, THEN the sprite will also be sent back to the starting box. When the player has successfully reached the end of the maze, the programmer can write a conditional that says IF the sprite touches the color of the ending box, THEN the program will display the words “Great job!”
Understanding the Coordinate Plane
Many Content Library Junior - and block-coding programs, in general - provide an opportunity for students to develop an understanding of the coordinate plane. This is because many programs require code related to movement.
In this subunit, there are two instances in which the coordinate plane is utilized. The first is to move the sprite throughout the maze. Students learn to write code to manipulate the arrow keys on the keyboard so that the sprite can move up, down, left or right. In Scratch, we do this by using a combination of two instructions: a when [insert key here] pressed instruction from the Events category and a change x by ( ) / change y by ( ) instruction from the Motion category. The default Motion instruction is to change x by (10) / change y by (10). We can think of “10” as steps, or units, that the sprite will travel. This number can be changed to a larger number, which would make the sprite travel further, or a smaller number, which would shorten the distance the sprite travels. Learning what this combination of instructions can do for a program enables students to do so much more, like program a character to be able to move throughout a video game. Though simple, it is an important concept for students to understand and is addressed often throughout many projects in Content Library Junior.
The Coordinate Plane and the Pen Extension
The second case in which we focus on the coordinate plane is when using the Pen Extension. The Pen Extension is an add-on extension in Scratch that creates an additional set of instructions for programmers to use so that they can draw on the program. Maze Game challenges students because they learn not only how to navigate and complete the maze, but how to actually create the maze using this extension.
Any sprite can draw the maze, or draw on the Stage of the program. In these lessons, we use the Pencil sprite to connect with the theme of drawing, but really any sprite can be programmed to draw a maze. We also teach students to hide the sprite, so the program will show the maze being created, but not the sprite that is drawing it.
When using the Pen Extension, the “pen” must be put down in order to actually draw. However, if the programmer forgets to pick the pen back up, the pen will continue drawing. This means that if the programmer wants to draw two lines that should not be connected, the pen must be picked up and moved before being placed back down again. This requires backward thinking and planning in order to code the program correctly.
Most instructions needed to draw a maze include changing x and y. The programmer must determine the coordinates of where the sprite should start drawing the maze and use a go to x: ( ) y: ( ) to send the sprite to the correct starting point. When moving the sprite using go to instructions from the Motion category, this is when the programmer needs to ensure the pen is lifted up so that it is not drawing as the sprite is moving to different positions. Then, the programmer can use a change x by ( ) or change y by ( ) to draw horizontal and vertical lines. Larger numbers will draw longer lines while smaller numbers will draw shorter lines. Some of the maze creation may be trial and error for young students, but that is an excellent way for them to understand what these instructions actually do and how to adjust the code so that it draws the maze as they intend.
Drawing Squares with the Pen Extension
The Content Library Junior module Draw Me a Picture explores how to use the pen extension to draw various shapes, but this unit also teaches students how to draw squares. If students have already completed Draw Me a Picture, creating the starting and ending boxes for the game is one way to test their skills from that unit. If they have not yet explored Draw Me a Picture, learning to draw a square is a great stepping stone to learning to draw other shapes.
Students (re)learn that a square has four equal sides and four 90 degree angles. Here, we can fuse what students learned earlier in the unit about loops with geometry skills to draw the starting and ending squares. We use a repeat ( ) loop from the Control category and repeat the code 4 times. Within the repeat (4) loop, we add a turn (90) degree instruction and a move (10) steps instruction, both from the Motion category, changing the steps to (30) so that the square is big enough to fit the sprite inside. Again, the programmer needs to remember to use a pen up instruction from the Pen Extension before moving the sprite to where the squares should be drawn. The programmer also needs to remember to place the pen down before incorporating the instructions for drawing a square.
Obstacles in Maze Game
Once the maze has been created, the final challenge presented to students is to add obstacles to the maze. We referenced this earlier in this article when discussing using the touch instruction from the Sensing category and conditionals from the Control category to send the sprite back to the starting box IF it touched the wall of the maze.
Similarly, the programmer can add sprites as obstacles. In this unit, we add a balloon sprite as an example. The balloon sprite has no instructions, but is used as a barrier. IF the sprite touches the balloon, THEN the sprite is sent back to the starting box.
If you’re looking to challenge your students even further, the next step could be to make the balloon (or obstacle object of choice) move up and down, side to side, etc. If the balloon is continuously moving, it may make it more difficult for the sprite to avoid as it navigates the maze. While this is not part of our lessons in this unit, this is an example of how students can be continuously challenged using Content Library Junior content.
Incorporating obstacles alone requires using problem-solving skills. So, planning and executing how to create the obstacle is yet another way that we can continue to build problem-solving skills with our students.
From math to problem-solving to art, this subunit exercises a plethora of skills simultaneously, making it a great option for your students! We outline how to create this program step-by-step, so even our beginning learners can benefit from learning to code a maze. All of our units are customizable to best fit your learners’ needs. It is our goal to help our students sharpen their problem-solving and 21st century skills with each activity to help them create the foundation for a strong future. Maze Game is no exception and just another activity that can be used for this purpose!
Stay connected with news and updates!
Join our mailing list to receive the latest news and updates from our team.
Don't worry, your information will not be shared.
We hate SPAM. We will never sell your information, for any reason.