🎯Calibrate
1Fill-in
2Debug
3Extend
4Create
🧠Concept
📓Reflect
👤 Your Details REQUIRED — fill in before you begin (★ = required)
Please fill in Name, Matric No., and Class before continuing.
🎯 Pre-Activity Calibration Complete this before unlocking the tiers
Before you start, think about what you already know about organising code into classes in Python. Your prediction helps you track how your confidence grows!
5
Be honest -- this is just for your own reflection later!



✏️ Tier 1 Fill in the Blanks — Snake & Game classes 6 blanks. All must be correct to advance.

Complete the Snake and Game class skeletons by filling in the missing parts. Each blank is a single keyword, value, or name.

___1___ Snake: def __init__(self): self.body = [(100,100),(80,100),(60,100)] self.___2___ = "RIGHT" def move(___3___): x, y = self.body[0] if self.direction == "RIGHT": x += 20 self.body.insert(0, (x, y)) self.body.___4___() class Game: def __init__(self): self.snake = ___5___() self.score = 0 def run(self): while ___6___: self.snake.move()
1___1___ Snake: — keyword that defines a class
2self.___2___ = "RIGHT" — name of the direction attribute
3def move(___3___): — first parameter of any instance method
4self.body.___4___() — list method to remove the last element
5self.snake = ___5___() — class being instantiated here
6while ___6___: — a value that keeps the loop running forever

🐛 Tier 2 Debug the OOP Code 3 bugs. Fix each one. 2 attempts max.

Each code snippet below contains exactly one bug. Type the corrected line in the input box.

Bug 1 — Missing method parameter

def move(): # inside class Snake
Hint: Every instance method in Python must receive the object itself as its first parameter.

Bug 2 — Missing instance reference

score += 1 # inside class Game, method update_score
Hint: Inside a class, instance attributes must be accessed through self.

Bug 3 — Missing parentheses when instantiating

self.snake = Snake # inside Game.__init__
Hint: Snake without () assigns the class itself, not an instance.
REFLECTION Mid-Activity Reflection


🔧 Tier 3 Extend — Add draw() Methods Add a draw method to both Snake and Food classes.

Add a draw(self, screen) method to both the Snake and Food classes. Each method should call pygame.draw.rect(screen, colour, rect) to draw the snake segments or food position. Use comments to explain each line.

import pygame class Snake: def __init__(self): self.body = [(100, 100), (80, 100), (60, 100)] self.colour = (0, 200, 100) def move(self): pass # movement logic here # Add draw(self, screen) method below: class Food: def __init__(self): self.position = (200, 200) self.colour = (220, 50, 50) # Add draw(self, screen) method below:


🏆 Tier 4 Create — Full Game Class Wrap the entire snake game into a single Game class.

Design a complete Game class that encapsulates the full snake game loop. Include: (1) __init__ creating Snake and Food instances, (2) update() moving the snake and checking food collision, (3) draw(screen) drawing all game elements, and (4) run() containing the main game loop. Comment each method's purpose.

import pygame # Assume Snake and Food classes are already defined above. # Write your complete Game class below. class Game: pass # replace with your implementation


🧠 Concept Concept Check — OOP & Classes 5 multiple-choice questions. Answer all then submit.

Test your understanding of classes, self, __init__, and encapsulation.

1. Which keyword is used to define a class in Python?

2. What does self refer to inside a class method?

3. What is the purpose of __init__ in a Python class?

4. Given snake = Snake(), how do you call its move method?

5. What best describes encapsulation in OOP?

POST-ACTIVITY Post-Activity Calibration & Reflection
5
Your self-estimate — be honest!



JOURNAL Reflective Journal — Step 9 (min 5 words per prompt)