Worked out Solutions and Vocabulary

But, really, what do I need to know about computer scienceto teach the Hour of Code?

A program is a set of instructions for your computer to follow. You build a program using commands. Here is a description of what each command in our activity does:

/ The move forward block advances a character one space on the grid of the maze.
/ The turn left block makes the character face to the left. It does notadvance the character any spaces on the grid
/ The turn right block makes the character face to the right. It does notadvance the character any spaces on the grid.
/ The repeat times block is called a loop in computer science. Whatever blocks you put inside this block will be repeated however many times you write in the top of the block. For example, if you put a “move forward” block followed by a “turn left” block inside the repeat times block and set it to repeat for 3 times, this is what will run: move forward, turn left, move forward, turn left, move forward, turn left.
/ The repeat until block is also a loop. It will repeat (or loop) whatever command you put inside of it until it reaches the end goal or runs into a wall in the maze. This block is useful in cases where you don’t know exactly how many times you need something to repeat until a specific end point.
/ The if blockmakes a decision for the computer. It checks to see if the statement on the top is true, and if it is true, the character will do whatever commands you put inside the block. If the statement on the top is not true, the character will do nothing. Note: when you click on the words “to the left”, it reveals a drop-down menu where you can choose other statements, the character can check: if there’s a path to the right or if there’s a path ahead.
/ The if else blockis very similar to the if block, but instead of doing nothing if the statement on the top is true, you can have it do an action or set of actions by placing commands in the “else” spot. For example, if you put a “move forward” block in the spot where it says “do” and you put a “turn left” block where it says “else”, the character will check to see if there’s a path ahead, and it there is, it will move forward, and if there’s not a path ahead, it will turn left. Note: there is also a drop-down menu in this block, just like the if block.

Here are the solutions for each puzzle with notes. Some notes include prompting questions for students, so you can walk around the classroom while students complete the activity and help students one on one who are struggling.

Puzzle # / Solution / Notes
1 / / Some students may have trouble finding the “Run Program” button. It’s the orange button below the maze.
2 / / Some students may have trouble connecting the blocks, so this puzzle reinforces that skill without adding new concepts.
3 / / This puzzle introduces the turn block. And now students must avoid obstacles, in this case, a crate of TNT.
4 / / This puzzle practices using both left and right turns.
5 / / This is the most difficult puzzle that practices the basic sequence of commands. If students get stuck, ask them to put themselves in the character position and what would they need to do to get to the pig?
6 / / This program repeats the “move forward” block 5 times to reach the pig. Students might be tempted to just use 5 “move forward” blocks but it’s important to know how to be efficient in computer science. Ask them to imagine if you needed to move forward 1,000 spaces.
7 / / The bird has to turn right and then perform the repeat block to get to the pig.
8 / / This puzzle needs 2 repeat blocks, and you have to change the number value in the first block from “5” to “4”. To do that, click on the number “5” and make sure it’s highlighted. Then hit the “delete” key on your keyboard and then press “enter” on your keyboard or click on the workspace.
9 / / Ask students to think about the solution using just “move forward” and “turn” blocks. Then ask them if they see any patterns that could be repeated. The repeat block is already out on the workspace to encourage students to use it.
10 / / This repeats the move forward command until the bird reaches the pig.
11 / / Once again, students should be encouraged to look for patterns to decide what actions to repeat.
12 / / Some students might write very long programs and then be tempted just to keep adding to them to try and fix them. You might tell them to start with a fresh workspace and ask them to think about the individual commands to get to the sunflower. Then identify a pattern and put those commands inside a repeat block.
13 / / This puzzle reinforces concepts from the last puzzle.
14 / / For this puzzle, students only have to fill in one block: they have to put a “turn left” block inside the “if” block. This program tells the zombie to repeatedly move forward and every step forward, the zombies check if there’s a path to the left. If the zombie finds a path to the left, it will turn left, and then keep moving forward.
15 / / Now, students must re-create code similar to the last level, but this time turning to the right. Ask students to think about what turns are necessary for the zombie to reach the sunflower. They’ll answer “all right-hand turns” and you can ask them to write code that makes the zombie move forward and only turn right when there’s a path to the right.
16 / / This is the same code from puzzle 14. You can point out to students that by using the “if” and “repeat” blocks, this program can be used to solve multiple different mazes (rather than just a sequence of move and turn blocks that will only solve a specific path.)
17 / / This puzzle is for practice and reinforcement with the “if” and “repeat” blocks.
18 / / Ask students how the zombie should get to the sunflower with the fewest number of turns. Then ask them are they left or right hand turns? They’ll say all left-hand turns, and you can tell them that the “if else” block can help you make decisions like that. If there’s a path ahead, move forward, and otherwise, turn left.
19 / / This is reinforcing to the last puzzle.
20 / / Ask students to read the code that is already out on the workspace. “If there’s a path ahead, what action would you want the zombie to do? Then, if there’s a path to the left, what do you want the zombie to do? And if there’s not a path to the left, what should you put in the “else” spot?” The zombie will move forward IF there’s a path ahead, otherwise it will decide IF there’s a path to the left and then do one of two actions (turn right or turn left) based on that decision.

Published by Google Drive–Report Abuse–Updated automatically every 5 minutes