Posted on

# (b) Modify the program in Q3(a), with the following new rules: – Players will need to win 3 games…

(b) Modify the program in Q3(a), with the following new rules: – Players will need to win 3 games to become the overall winner. – Implement a penalty – for the player who skipped, entered an incorrect expression, or entered an expression that evaluated to the wrong result, will draw 2 random digits into their hand. – The player who loses the game will be awarded a “Skip” card in the next game. With the “Skip” card, the player can hit < Enter > to skip, without a penalty. – If not utilized, the “Skip” cards CANNOT be carried forward to the next game.

Illustration of the “new” game on the left column, with the rules of the game explained on the right column:
Enter player: Alan
Enter player: Betty
Enter player:
Starting hand (number) of digits: 4

Let’s play…
Game 1
Round 1: Result 6
Betty’s hand: [5,2,1,1]
Enter expression: 5+1
Correct!
Betty’s hand: [2,1]
Alan wins this game in 4 rounds!!
Overall game score: Alan 1, Betty 0

Let’s play…
Game 2
Round 1: Result 5
Betty’s hand: [3, 6, 5, 7, ‘S’]
Enter expression:
Skipped with no penalty!!
Betty’s hand: [3,6,5,7]
Alan’s hand: [2,1,2,1]
Enter expression:
Skipped and 2 digits added to hand
Alan’s hand: [2,1,2,1,4,7]
Betty wins this game in 5 rounds!!
Overall game score: Alan 1, Betty 1

Let’s play…
Game 3
Round 1: Result 6
Betty’s hand: [1, 2, 8, 7]
Enter expression: 8-2
Correct!
Betty’s hand: [1, 7]

Computer randomized the play sequence and will stay the same for every game/round

End of game, if no overall winner, continue to play another game. Loser will be awarded a “Skip” card in the next game. “S” represents the “Skip” card awarded to Betty. No penalty for Betty as she has a “Skip” card. Hit < Enter > key to skip if cannot form an expression. In this case, the player who skipped will draw 2 random digits into their hand.

End of game, if no overall winner, continue to play another game. Loser will be awarded a “Skip” card in the next game.

Solved By Verified
Study Co-Pilot

Instant