Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JavaScript i. ii. iii. iv. V. vi. j. [6 marks] Function tallyOnePlay(). No parameters. This function completes one play of the slot machine as follows:
JavaScript
i. ii. iii. iv. V. vi. j. [6 marks] Function tallyOnePlay(). No parameters. This function completes one play of the slot machine as follows: Stop the scheduled every 50 ms) function rollslots() from occurring. Set the currentWin value by using calculatePayout(). Add the currentWin value to the currentCredits. Update the play statistics (refer to updatePlayStats(). Invoke updateWinner() as needed. Enable all three buttons ("Place Bet of 1 Credit, Place Bet of 3 Credits, and Play Me Now!") k. [1 mark] Event handler for Play Me Now!" button (with id btnPlay). If the user has enough credits to play, invokes the scheduleOnePlay() function. I. [4 marks] Add to/modify the existing code to implement a "cheater mode" with a guaranteed win for the upcoming one round of play. The desired behavior is as follows: i. If the player mouse over the Jackpot image, set a boolean variable flag to indicate that this round of play is in cheater Mode. Use this flag to "flip" all of the slot values (and images) to be the same value as currentslot1 after the rollslots() has stopped. ii. i. ii. iii. iv. V. vi. j. [6 marks] Function tallyOnePlay(). No parameters. This function completes one play of the slot machine as follows: Stop the scheduled every 50 ms) function rollslots() from occurring. Set the currentWin value by using calculatePayout(). Add the currentWin value to the currentCredits. Update the play statistics (refer to updatePlayStats(). Invoke updateWinner() as needed. Enable all three buttons ("Place Bet of 1 Credit, Place Bet of 3 Credits, and Play Me Now!") k. [1 mark] Event handler for Play Me Now!" button (with id btnPlay). If the user has enough credits to play, invokes the scheduleOnePlay() function. I. [4 marks] Add to/modify the existing code to implement a "cheater mode" with a guaranteed win for the upcoming one round of play. The desired behavior is as follows: i. If the player mouse over the Jackpot image, set a boolean variable flag to indicate that this round of play is in cheater Mode. Use this flag to "flip" all of the slot values (and images) to be the same value as currentslot1 after the rollslots() has stoppedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started