🎯Calibrate
1Fill-in
2Debug
3Extend
4Create
🧠Concept
📓Reflect
👤 Your Details REQUIRED — fill in before you begin (★ = required)
🎯 Before You Begin Calibration Check 2 questions + 1 reflection — unlocks Tier 1
Think about the structure of a game loop: what runs every tick? How does pygame detect the window-close button, and how do we cap the frame rate?
1 10 5
Tier 1 Fill in the Blanks Complete the code skeleton — 9 blanks

Complete the pygame game loop. Fill each blank so the loop handles events, redraws the screen, and limits the frame rate.

running = ▢1
clock = pygame.time.▢2()

while ▢3:
    for event in pygame.event.▢4():
        if event.type == pygame.▢5:
            running = ▢6
    screen.fill(BG)
    pygame.display.▢7()
    clock.▢8(▢9)

pygame.quit()
1.Blank 1: T___
2.Blank 2: C____
3.Blank 3: r______
4.Blank 4: g__
5.Blank 5: Q___
6.Blank 6: F____
7.Blank 7: f___
8.Blank 8: t___
9.Blank 9: S__________
Tier 2 Find & Fix the Bugs 3 bugs to correct

The code below has 3 bugs. For each bug, type the corrected line in the box provided.

running = True
clock = pygame.time.Clock()

while running:
    for event in pygame.event.get():
        if event.type == pygame.KEYDOWN:   # Bug 1
            running = False
    screen.fill(BG)
    pygame.display.flip()
    clock.tick(30)                         # Bug 2
                                           # Bug 3 – something is missing here
pygame.quit()

Bug 1

Buggy line:

if event.type == pygame.KEYDOWN:

Your fix:

Hint: Which event means the user clicked the ✕ button?

Bug 2

Buggy line:

clock.tick(30)

Your fix:

Hint: Hard-coded 30 FPS ignores the SNAKE_SPEED constant — use the variable.

Bug 3

Buggy line:

# (nothing after screen.fill)

Your fix:

Hint: The display is never updated — which function pushes the frame to the screen?

Reflection 2 Mid-Point Check-In
Tier 3 Extend the Code Add the feature described below

Add a **pause feature**: pressing the P key should toggle a `paused` variable. When `paused` is True, skip the game-update step but still redraw the screen.

running = True
paused  = False
clock   = pygame.time.Clock()

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYDOWN:
            # YOUR CODE: toggle paused when K_p is pressed
            pass

    if not paused:
        pass   # game update goes here

    screen.fill(BG)
    pygame.display.flip()
    clock.tick(SNAKE_SPEED)
Tier 4 Create from Scratch Open-ended challenge

**Challenge:** Display a live FPS counter in the top-right corner of the window each frame. Use `clock.get_fps()` and `pygame.font.SysFont` to render it. Paste your complete updated loop.

🧠 Concept Check Test Your Understanding 5 quick questions — required before the Reflective Journal 🔒

Answer all 5 questions, then the Reflective Journal will unlock.

1. What does clock.tick(FPS) control inside the game loop?

2. Which pygame event type fires when the user closes the window?

3. What is the game loop responsible for each iteration?

4. How many times does while True: run (with no break)?

5. What value does pygame.event.get() return when no events have occurred?

📓 Reflective Journal 5 prompts — required before Step 2 is marked complete 🔒

Answer each prompt thoughtfully. There are no right or wrong answers — this is your own reflection.

⚠️ You must complete the Concept Check above before submitting your journal.

🎯 Post-Activity Check-In After Completing All Tiers Complete after the Reflective Journal to finish this step 🔒
1. How confident do you feel about this step’s concepts now? (1 = not confident, 10 = very confident)
1 10 5
2. Your Tier 1 first-attempt score (auto-filled)
%