Expected Time: 60 - 90 minutes
Students will be able to apply these concepts:
- Using code blocks to create a program
- Sequencing of steps
- Loops for repetition
- Conditional statements and branching logic
- Tynker Code Block (Module 1)
- Program (Module 1)
- Execute (Module 2)
- Sequence (Module 2)
- Conditional (Module 10)
New Tynker Code Blocks
Materials, Resources, and Prep
- One computer for each student to log on to tynker.com or one iPad for each student with the Tynker app installed.
- Have your classroom crayon bin, scissors bin, or paper tray nearby and stocked full, for use in Module 1.
- (Optional) Prepare teacher computer screen to display to whole class, which will be used in the Wrap-Up at the end of the lesson.
- (Optional) Have the Bill Gates video from the middle of this page (https://code.org/educate/videos) ready to show students during the Wrap-Up
Display your screen as you lead the whole class in working through the first five modules, using the guidance below. Module 6 is the best module to start having students try on their own computers or iPads.
1. "Pick Up the Candy" (puzzle)
- Point out the “Click anywhere to continue” button in the lower right of the screen that you need to use regularly when ready to move forward.
- Show students that there are two important sections of the screen: the left section (where the “Walk” block is now) will always have the Tynker code blocks available to use, and the middle section (where the “On Start” block is now) is where students create their program to tell the computer what to do. We’ve given them a start on this program by putting the “On Start” block in place.
- Show them how to drag a block from the left section to the middle section. Connect the “Walk” block to the bottom of the “On Start” block.
- Point out that when you dragged the "Walk" block from the left section, there was another "Walk" block. They should think of the code blocks on the left as a bin full of as many "Walk" blocks as they need. You could give a physical demonstration of this idea, using one of your classroom bins, like a crayon bin or paper tray. Pull out one crayon or one piece of paper, and point that there are plenty still left to use in the bin. This is how to think of the Tynker Blocks in the left section. (Although the classroom bin will sometimes run out, the Tynker code block bins don’t!)
- Say to the class: “In order to get Codey to the candy, we need to make him walk two steps forward, so we need to drag another 'Walk' block into the middle section, and connect it below the previous 'Walk' block.” (Notice that a "Walk" block still remains in the bin on the left in case we need more, but we don’t in this case.)
- Tell students: “Now we have created the program, we click on the Play button in the lower-right of the screen to try running the program.”
- "Hooray! We did it. We can see Codey chomp the candy! Our program did what we wanted it to do, and we get a Congratulations message!"
- Now you have the option to Replay this program, or go to the Next puzzle. Choose Next, which takes you to the next module.
2. "Get the Gum Drop" (puzzle)
- Now we see Puzzle 2 highlighted at the top of the page, and we are asked to “Program Codey to walk to the gum drop.”
- First, click or tap anywhere to continue.
- Say: “Notice again that the ‘On Start’ block has already been put in place for us, and we can use the ‘Walk’ blocks on the left in our program. How many do we need this time?”
- After one or more students tells you that you need four Walk blocks, drag them from the left to the middle section and connect them to the “On Start” block.
- Run the program and see Codey get the gum drop.
- After the Congratulations message this time, choose Replay.
- Point out to the class how each code block is highlighted in green when “executing.” A computer program “executes” a “sequence” of steps in the order you tell it to when it runs.
- Say: “Computers are actually kind of dumb, because they only do exactly what we tell them to do!”
- Say: “What if our program doesn’t work? Sometimes we tell the computer to do something the first time, but we later realize that isn’t actually what we meant to tell it to do. This happens a lot to computer programmers, but it’s no big deal! They just keep working on their program until they get the computer to do what they really wanted.”
- Choose Replay again. Say: “This time, let’s see what happens if our program doesn’t do what we want. Let’s drag one of the 'Walk' blocks from our program back to the bin on the left. What do we think is going to happen when we run the program now?” Call on students to offer their thoughts about what Codey will do.
- After you’ve heard their predictions, run the program again and see Codey stop after three steps. You'll get a hint on how to fix the program: double-check how many "Walk" blocks to use. Closing the hint takes you back to the program, where you can put the fourth "Walk" block back in place and run it again.
- You may want to point out to the class that this is what they'll do a lot with computer programming:
- 1) Build a program.
- 2) Take a look at each step in the program and predict exactly what you expect will happen.
- 3) If you think you’ve made a mistake, change the program.
- 4) Once you’ve gotten the program like you want it, try running it.
- 5) You’ll probably find on your first (and second, and …) try that it didn’t do what you wanted, and you need to fix something.
- 6) Change the program, and try re-running it.
- 7) Keep on doing this until the program works like you want!
3. "Avoid the Obstacles" (puzzle)
- We recommend you work on this puzzle with the whole class still, even though most could figure it out on their own, because it will be helpful for you to lead them through Modules 4 and 5 together.
- The new feature of this puzzle is an obstacle that Codey needs to jump over, in addition to walking.
- Experiment with using "Jump" in a program with them to see exactly how it works. The jump needs to start in the space before the obstacle, and it ends in the space after.
- Ask the class for input until they figure out they need this sequence of steps : "On Start - Walk - Walk - Jump - Walk."
- Celebrate with them when they solve the puzzle and Codey gets his mint!
4. "Repetition with Loops" (puzzle)
- Onward with the whole class!
- Ask for ideas on how to solve the puzzle. Some students might suggest a program that gets Codey to his gum drop using nine "Walk" blocks and no "repeat" blocks. This is fine at this point! Show them that this strategy works.
- Other students will probably suggest using the "repeat" block. If not, you can suggest it! Point out that whatever code blocks they want to repeat need to get placed inside the "repeat" block, not connected below it. Observe together what happens if the "Walk" block is placed below, rather than inside, the "repeat" block.
- Say, “In this example you see you can create programs that get Codey to his gum drop in different ways. So when you are programming, just as in solving math problems, or writing stories, you should not expect that there is just one correct way to do it. You can be creative! And you can also ask which method you think is better, or which you prefer. Do you think this program is better with or without the "repeat" block?” Listen to the students' ideas.
5. "Repeat the Pattern" (puzzle)
- It is helpful to keep the class together to look at this puzzle.
- In this puzzle, students don’t need to use the "repeat" block to get Codey to the gum drop. We actually recommend that you first ask students to suggest a solution that just uses "Jump" and "Walk". They should come up with: "Jump - Walk - Jump - Walk - Jump - Walk."
- Choose Replay and look at the program again. Observe aloud that in this sequence of six steps, the two steps "Jump - Walk" together are repeated three times. Write "Jump - Walk" on your board and put a circle around them. Write "Jump - Walk" on the board below that, and put a circle around them. Then circle another "Jump - Walk" and say, “So we are actually repeating Jump - Walk three times in this program. We can use the 'repeat' block as a shortcut.”
- Show how you can use the Menu button in the upper right corner and choose Start Over to erase your program and start from scratch.
- Drag a "repeat" block over to the middle.
- Drag "Jump" inside the "repeat" block, then say, “Even though it looks like the 'repeat' block is full now, it grows to make room for as many blocks inside it as we want to use. Then all the blocks inside there get repeated.” Drag a "Walk" block over and show that it can connect to the bottom of the "Jump" block inside the "repeat" loop.
- It is a valuable programming habit to look at a program and think through what’s going to happen, so encourage this! Ask for students’ help in stating each step they expect will happen when you run the program. Then press play and watch the blocks highlight in green as "Jump" and "Walk" repeat three times.
6. "Sequenced Repetition" (puzzle)This is a good puzzle for students to begin tackling on their own.
- Circulate around the room and ask students to share their thinking with you while they work.
- The first program students come up with may not work. Let them try out their ideas, even if you know their program won’t work. Encourage them to keep working on the program and trying it until Codey gets the gum drop.
- Help them pay attention to whether they want they want a second "Walk" block inside the "repeat" block or outside it. You can ask them to think about and predict what would happen if the second "Walk" block goes inside. They can try it and observe the result.
- It’s fine at this point if they don’t use the "repeat" block. They’ll use it eventually in future modules and lessons!
7. "Two Loops" (puzzle)
- There are a variety of ways to solve this puzzle, so students can be creative. Challenge those who find one solution quickly to come up with a different one! The title of this module gives a hint that one way to solve it uses two "repeat" blocks.
- You can also point out to students that you can change the number inside the "repeat" block to tell the computer how many times to repeat the steps inside.
- Students may figure out they don’t need to have an obstacle to use the "Jump" block; it just moves them forward two spaces. So here’s a different creative solution to this puzzle: "On Start - Jump - Walk - Jump - Jump - Walk."
- It can be tricky to drag the code blocks to connect to other blocks exactly where you want them. If students are getting different results than they expect, help them to check if their blocks are connected in the right places, and adjust them.
8. "Using Conditional Loops" (puzzle)
- The new feature in this puzzle is the "repeat until" block. Rather than repeating the blocks inside for a definite number of times, the blocks repeat until the “condition” inside the "repeat" happens. In this case, the blocks repeat until Codey has the jelly bean.
9. “Using 'Not' in Loops” (puzzle)
- The "repeat while" block is another style of loop, with the word “not” in it.
- This puzzle should be straightforward for most students.
10. "Conditionals" (puzzle)
- The new feature is a “conditional” statement, which usually means an “if” code block is used.
- In this puzzle we want to make Codey keep doing some stuff until he gets to the red mint. So we first place a "repeat until" block that everything else will go inside.
- Next, we want to make Codey walk to the mint. But if he comes across a blue block, he needs to jump instead. So we use: “If [blue block]” then Jump.
11. "Multiple Conditionals" (puzzle)
- This is similar to the last puzzle, but two “if” code blocks are used.
- You still want Codey to repeat some steps until he gets the red mint.
- What you want him to repeat: If there’s a blue block then jump. New: If there’s an open path ahead in the next space, then walk.
12. "If-Else" (puzzle)
- This puzzle is very similar to the previous one, except a new “if-then-else” code block is used instead of two “if” blocks. The logic is much the same. If bottle cap then "Jump," else "Walk."
- It’s not helpful for students to click on or use the ‘+’ symbol after the “else” at this point. It reveals another “if-then-else” that could be used if needed.
Celebrate with students as they earn their first badge!
Wrap Up and Extend the Learning
- Say: "Some of the skills and code blocks you already learned to use today are really important in computer programming. Here is a two-minute video by Bill Gates, the founder of Microsoft, explaining how 'if' blocks can be used in the real world, or in making a zombie move." Play the Gates video in the middle of this page: https://code.org/educate/videos. Note he also shows a "repeat until" code block.
US Standards Addressed
- L1:3.CT.1, L1:3.CT.4, L1:6.CT.1, L1:6.CPP.1, L1:6.CPP.5, L1:6.CPP.6
UK Standards Addressed
UK equivalent grade/class - Year 4/Year5
National Curriculum of England (Computing)
understand what algorithms are, how they are implemented as programs on digital devices, and that programs execute by following precise and unambiguous instructions
use logical reasoning to predict the behaviour of simple programs
design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts
use sequence, selection, and repetition in programs, work with variables and various forms of input and output
use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs
select, use and combine a variety of software (including internet services) on a range of digital devices to design and create a range of programs, systems and content that accomplish given goals, including collecting, analysing, evaluating and presenting data and information
Mathematics Standards, Year 4/Year5