Explain how the REPEAT UNTIL loop controls the flow of the game. Identify the loop condition and describe what happens inside one full iteration.
–• Correctly identifies the loop condition: player1Score = 100 OR player2Score = 100
–• Describes both players spinning, score updates via IF/ELSE IFs, and spin counters incrementing
–• Mentions display of scores after each player's turn
Describe the role of player1Name and player2Name variables. How does the program use them to improve usability?
–• States that names personalize score displays and win messages
–• Mentions input collection via INPUT()
–• Connects to output statements using concatenation
What user-facing messages are displayed, and how do they support usability?
–• Mentions welcome, per-turn score displays, closing/win messages
–• Explains feedback loop for players
Critique the use of '=' vs '←' in variable updates. Identify any inconsistencies and their implications.
–• Observes assignment operator varies
–• Explains that in CSP pseudocode, ← is assignment and '=' is comparison
–• Notes potential programmer confusion
Trace the algorithm for the case targetNum = 10 and player1Spin = 12. What points, if any, are awarded to Player 1 this turn? Justify using the pseudocode.
–• Recognizes ELSE IF branch for ±2 around targetNum
–• States Player 1 receives 1 point
–• Supports answer by referencing condition player1Spin = targetNum + 2
Explain why player1Score and player2Score must be initialized to 0 before the loop. What bug could occur if they were not?
–• Identifies need for deterministic starting state
–• Explains that uninitialized values could cause immediate loop termination or incorrect scoring
–• Links to loop condition and comparisons
Propose a modular decomposition: identify and describe one procedure with a parameter that could be defined to encapsulate behavior.
–• Names procedures like getPlayerName(), spinAndScore(), displayScore(), announceWinner()
–• Explains parameters
–• Explains what the procedure returns/completes
If REPEAT UNTIL uses equality (player1Score = 100 OR player2Score = 100), could the loop fail to terminate when a score jumps from 99 to 101? Propose a fix.
–• Recognizes equality check is too strict
–• Suggests >= comparison
–• Explains why
Analyze whether the win announcements after the loop can ever display both players as winners. Use logical reasoning on the loop condition and post-loop IFs.
–• Explains that IF statements both will run after exiting the loop
–• Explains sequential post-loop IFs could both be true if both reached 100 during the last iteration
–• Explains that the loop will not terminate early even if player1 gets the required score (both players get their turn)
Suppose we want to track the current leader each iteration. Design variables and updates to implement this feature.
–• Introduces leaderName and leaderScore or a boolean flag
–• Explains update after both players' turns per iteration
–• Describes display of leader
Hypothetically, you want to extend the program to support N players. Describe data structures and loop changes.
–• Uses list/array of player records
–• Iterates over players in each round
–• Tracks winner
Suppose you change the line that sets the target number from RANDOM(1, 20) to RANDOM(1, 10). What kind of problem could this cause in the game? Explain how this change would affect how the program works.
–• Identifies the change (target number only between 1 and 10)
–• Explains that the wheel still spins numbers from 1 to 20
–• Describes how the game is now unfair – it is impossible to get 5 points for spins above 10.