Lesson 2.06: Game Loop
Learning Objectives
Students will be able to…
- Define and identify: while loop
- Use a while loop to simulate game play
Materials/Preparation
- Do Now
-
Lab - Tic-Tac-Toe Revisited (printable lab document) (editable lab document)
- Associated Readings 2.7
- Read through the do now, lesson, and lab so that you are familiar with the requirements and can assist students
Pacing Guide
| Duration | Description |
|---|---|
| 5 Minutes | Do Now |
| 10 Minutes | Lesson |
| 35 Minutes | Lab |
| 5 Minutes | Debrief |
Instructor’s Notes
1. Do Now
- Students experiment with creating
whileloops.
2. Lesson
Instruction
- Ask students what the
whileloops that they created did. - Go over the syntax of
whileloops. Use this as an opportunity to remind students of boolean expressions.
Discussion
- Ask: how might while loops be useful?
- Ask students to consider how they could write a loop using user input, using the following scenario:
- What if you wanted the loop to stop when the user inputs “quit”?
Activity
- Have the students think about and write a solution
Student Share
- call students up to the board to write out how they solved it.
3. Lab
- Students work to create a Tic-Tac-Toe game that allows turns (up to 9), building on their previous work.
4. Debrief
- Check for completion and understanding of the lab.
Accommodation/Differentiation
If there is extra time, have students start reading through the project specs and thinking about how they will apply what they have learned this unit to complete the project.