Lesson 2.07: 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
  • Associated Reading - section 2.7 of Book
  • 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 while loops.
  2. Lesson
    • Ask students what the while loops that they created did.
      • Go over the syntax of while loops. Use this as an opportunity to remind students of boolean expressions.
        • 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"?
        • Have the students think about and write a solution, then 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.