Section 0.4
Algorithms for a Robot Maze
Learning Goals
Define algorithm as a set of clear and unambiguous instructions to solve a problem or perform a specific task.
Create an algorithm in a natural language and in pseudo code.
Combine and modify algorithms.
Objectives and General Description
The objectives for this lesson are to introduce students to the concept of an algorithm and develop a clear definition on an algorithm. Students will also create an algorithm in both their natural language and in psuedo code to move a human robot through a maze. Students will work in teams to develop new algorithms to solve the same problem.
Robot programming is using logic to facilitate the movement of an object through a maze. This can be accomplished using humans as the objects, on paper and pencil using a small item as the object or in a digital format using a sprite or a turtle as the object to be moved. Algorithms are created and tested to arrive at a solution. A successful algorithm requires the decomposition of a complex problem into clear, specific and manageable steps. This is a core skill in programming and procedural abstraction. In this lesson, students will be programming a human robot (their classmate) through a maze with obstacles throughout. They will collaboratively design an algorithmic solution, test it and then create alternative algorithms to achieve the same goal. If time remains, students will use the same concept to solve robot maze problems online.
Activities
Activity 0.4.1 (Budget 30 minutes)
Students review algorithm definition and translate the concept to robot programming and computer instructions.
Students were introduced to the concept of an algorithm on day 2. As a class warm up, have students individually write a definition for algorithm. Then share with a partner and agree on a definition. The pairs of partners get together and do the same thing. Continue until you have the class divided into 2 - 3 groups. Each group has an agreed upon definition. Compare the 2 - 3 definitions and agree upon a class definition. Have a student write this on the board or display in some manner. Explain that algorithms are a series of instructions to solve a problem. Each instruction must be clear and specific (remind them of the sandwich activity from day 2).
Tell students that they are going to be programming human robots to get through a maze. Divide the class into groups of four. Each group of four will have a maze (sample maze template). Each student will have a copy of the Robot Algorithms API worksheet.
Students will predict the movement needed to get a robot from a starting point to an ending point on the maze using a specific set of commands. See worksheet for the commands. Students should collaborate and decide upon the commands needed. Then they should write down the commands on the worksheet. Finally one student will verbally give the instructions while another student becomes the robot and moves according to the instructions.
There are five different tasks with various starting and ending points. Students should complete all of them.
Then students are asked to create another task and decide upon the starting and ending points.
Students are then asked to select two previous tasks and modify the code to achieve the same result. One modification requires the use of the REPEAT block and the other modification requires the use of the CAN_MOVE block.
Optional extensions:
Have two or more robots moving at the same time. Robots can not be on the same block.
Block off various squares on the grid so they can't be used. Laying a piece of paper over a block is a quick, temporary method of removing a block from use.
Join two or more grids together to make a larger maze.
Examples of this activity are included as images below for teacher reference.
Activity 0.4.2 (Budget 15 minutes)
Students can transfer their robot programming skill to a computer platform. The following resources are great for robot/sprite programming.
Blockly maze: Ten levels of robot programming.
CodeHS.com - Intro to programming with Karel the Dog. Teacher can set up a free account and invite students to join.
Sphero robots
Resources
0.4.1: Examples of Activity (teacher resource)
0.4.2: Computer Platform Options for Robot Programming (student resources)