Question: it has to be in java play(userSelection) This method takes in 1 parameter: the user Selection. It will: Get the CPU Random selection using the
it has to be in java


play(userSelection) This method takes in 1 parameter: the user Selection. It will: Get the CPU Random selection using the generateCPUResponse() Determine the winner using the determineWinner(user Selection, cpuSelection) update the score tally this.score // if the user won the round this.score.user ++; // if the user cpu the round this.score.cpu ++; OR this.score = { user: NEW_SCORE, cpu: NEW_SCORE Add another historyLog entry to the game history array. the log entry should look something like this Ben selected Scissors, CPU selected Paper: Ben wins wins this gameHistoryLog.push("Ben selected Scissors, CPU selected Paper: Ben wins wins"); generateCPUResponse() For this function: 1 Create an array with the following values const acceptedValues = [ 'rock, 'paper", 'scissors ] 2 Using both Math.random and Math.floor() methods, generate a random index number (0,1,2) 3 return the value of acceptedValue at the random index generated in the previous step
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
