UESL 3.1 Homework
Popcorn Hack
Code Runner Challenge
UESL 3.1 Popcorn - Keep the checkpoint
View IPYNB Source
# CODE_RUNNER: UESL 3.1 Popcorn - Keep the checkpoint
stars = 8
checkpoint_stars = stars
stars = stars + 4
print(stars)
print(checkpoint_stars)
# The output will be 12 for stars and 8 for checkpoint_stars
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...
Checkpoint debrief · reveal after predicting
Both versions display 12, then 8. The checkpoint holds the earlier value.
MCQ Check · Maker decisions
Record A, B or C for each before revealing the key.
- A player tag is
"007". Best type? A integer · B string · C Boolean. - After
stars ← 8,checkpoint ← stars,stars ← 12, what ischeckpoint? A 8 · B 12 · C 20. - Which AP operator assigns a value? A
=· B==· C←. - A bonus changes a level’s stars. When does a previously stored total change? A Automatically · B When reassigned/recalculated · C When displayed.
MCQ answers and explanations
B, A, C, B. Text preserves 007; the checkpoint copied 8; the arrow assigns; displaying a total does not recalculate it. Count one point per correct answer and record your actual score out of 4.
Homework Hack · Build your UESL star counter
- Choose a game name and a reduced-motion Boolean setting. Use separate level-star variables starting at
12,18,10; print the name, setting and total. - Add a bonus of
5to level two. Print the stored total, then recalculate and print it again. - Record predictions and actual results: original/stored total
40, updated total45. Restart with bonus0; all three totals should be40. - Design-thinking note: Name a player’s need, your goal, a setting/representation you considered, the prototype you built, and one test or revision. Explain why reduced motion should be a player choice.
Next mission: 3.2 replaces separate level variables with a collection. What would 100 separate variables cost a game maker to maintain?
MCQ Answers
- B
- A
- C
- B
Code Runner Challenge
Homework Hack - UESL star counter
View IPYNB Source
# CODE_RUNNER: Homework Hack - UESL star counter
game_name = "Sky Sprint"
reduced_motion = True
level1_stars = 12
level2_stars = 18
level3_stars = 10
stored_total = level1_stars + level2_stars + level3_stars
print("Game:", game_name)
print("Reduced motion:", reduced_motion)
print("Original total:", stored_total)
bonus = 5
level2_stars = level2_stars + bonus
updated_total = level1_stars + level2_stars + level3_stars
print("Stored total after bonus:", stored_total)
print("Updated total after recalculation:", updated_total)
level1_stars = 12
level2_stars = 18
level3_stars = 10
bonus = 0
original_total_restart = level1_stars + level2_stars + level3_stars
level2_stars = level2_stars + bonus
stored_total_restart = original_total_restart
updated_total_restart = level1_stars + level2_stars + level3_stars
print("Restart original total:", original_total_restart)
print("Restart stored total:", stored_total_restart)
print("Restart updated total:", updated_total_restart)
print("Design-thinking note:")
print("Player need: Some players feel dizzy from motion effects.")
print("Goal: Keep gameplay readable and comfortable.")
print("Setting considered: Reduced-motion toggle and clear star counters.")
print("Prototype built: A star counter with a reduced-motion option.")
print("Test/revision: I tested bonus updates and made totals easy to compare.")
print("Why choice matters: Players should control comfort and accessibility.")
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...