Popcorn

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)
Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Prediction stars: 12 checkpoint_stars: 8

Actual Output:

12 8


Checkpoint Explanation: The variable checkpoint_stars copied the value stored in stars (8) at the exact moment the line checkpoint_stars = stars executed. In Python and AP Pseudocode, assignment copies the value on the right-hand side to the variable on the left. When stars is modified later (stars = stars + 4), checkpoint_stars retains its original copied value of 8 because it is a independent variable, not a live reference or dynamic link.

MCQ

Question 1: B (string) — “007” requires a string to preserve leading zeros, which would be lost as an integer 7.

Question 2: A (8) — checkpoint holds the value 8 copied prior to stars being reassigned to 12.

Question 3: C (←) — The left arrow ← is the College Board AP Pseudocode assignment operator (= is used in Python, while == checks equality).

Question 4: B (When reassigned/recalculated) — Stored totals store static evaluated values and do not automatically update when component variables change.


Score: 4/4 | Answers: B, A, C, B

Homework

Game setup & configuration

game_title = “UESL Star Trail” reduced_motion = True

Initial level star counts

level_one_stars = 12 level_two_stars = 18 level_three_stars = 10

Calculate initial total

total_stars = level_one_stars + level_two_stars + level_three_stars

Display game title, accessibility setting, and initial total

print(game_title) print(“Reduced Motion:”, reduced_motion) print(“Initial Total Stars:”, total_stars)

Apply bonus to level two

bonus = 5 level_two_stars = level_two_stars + bonus

Print stored total prior to recalculation

print(“Stored Total (before recalculation):”, total_stars)

Recalculate total and print updated total

total_stars = level_one_stars + level_two_stars + level_three_stars print(“Updated Total (after recalculation):”, total_stars)

Tests

Test 1: Bonus = 5
Prediction:

Initial Total: 40

Stored Total (before recalculation): 40

Updated Total (after recalculation): 45


Actual Output:


UESL Star Trail Reduced Motion: True Initial Total Stars: 40 Stored Total (before recalculation): 40 Updated Total (after recalculation): 45


Test 2: Bonus = 0 (Restart / Control Test) Prediction:

Initial Total: 40

Stored Total (before recalculation): 40

Updated Total (after recalculation): 40

** Explanation of Test Results **

When level_two_stars increases, total_stars remains at 40 until line 25 re-evaluates the addition expression. Variables in Python store static values evaluated at the exact instant of assignment; changing an underlying variable does not retroactively update dependent variables unless explicit reassignment occurs.


Design Thinking

Player Need: Players with motion sensitivity or neurodivergent processing needs require options to disable rapid visual animations or camera shakes to avoid disorientation or physical discomfort.

Goal: Represent player preferences and level scores using appropriate Python data types while accurately managing variable state changes.

Setting / Representation Considered: Evaluated storing reduced_motion as a string (“enabled”/”disabled”) vs. a Boolean (True/False). Selected a Boolean (bool) because a true/false binary choice fits on/off settings directly and works cleanly with conditional logic.

Prototype Built: A Python star-counter prototype initializing player settings (game_title: str, reduced_motion: bool), tracking individual level scores (int), and handling score recalculation via explicitly assigned totals.

Test or Revision: Tested updating level_two_stars with a bonus. Realized that total_stars did not automatically change after modifying a level score, so I revised the workflow to explicitly recalculate total_stars immediately after any score update.

Why Reduced Motion Should Be a Choice: Forced screen movement, parallax scrolling, or aggressive camera shakes can trigger motion sickness, sensory overload, or vestibular distress. Providing a togglable reduced-motion setting makes the game accessible and comfortable for all players.