////////////////////////////////////////////////
/*   Provided Code - Please Don't Edit   */
////////////////////////////////////////////////
'use strict';

function getInput() {
    console.log("Please choose either 'rock', 'paper', or 'scissors'.")
    return prompt();
}
function randomPlay() {
    var randomNumber = Math.random();
    if (randomNumber < 0.33) {
        return "rock";
    } else if (randomNumber < 0.66) {
        return "paper";
    } else {
        return "scissors";
    }
}
////////////////////////////////////////////////
/*           Write Your Code Below            */
////////////////////////////////////////////////

function getPlayerMove(move) {
    // Write an expression that operates on a variable called `move`
    // If a `move` has a value, your expression should evaluate to that value.
    // However, if `move` is not specified / is null, your expression should equal `getInput()`.
    return move || getInput();
}

function getComputerMove(move) {
    // Write an expression that operates on a variable called `move`
    // If a `move` has a value, your expression should evaluate to that value.
    // However, if `move` is not specified / is null, your expression should equal `randomPlay()`.
    return move || randomPlay();
}

function getWinner(playerMove,computerMove) {
    var winner;
    // Write code that will set winner to either 'player', 'computer', or 'tie' based on the values of playerMove and computerMove.
    // Assume that the only values playerMove and computerMove can have are 'rock', 'paper', and 'scissors'.
    // The rules of the game are that 'rock' beats 'scissors', 'scissors' beats 'paper', and 'paper' beats 'rock'.
    /* YOUR CODE HERE */
  if(playerMove === "rock" && computerMove === "scissors") {
      winner = "player";
  } else if(playerMove === "scissors" && computerMove === "paper") {
      winner = "player";
  }  else if(playerMove === "paper" && computerMove === "rock") {
      winner = "player";
  } else if(playerMove === computerMove) {
      winner = "tie";
  } else {
      winner = "computer";
  }
  return winner;
}

function playToFive() {
    console.log("Let's play Rock, Paper, Scissors");
    var playerWins = 0;
    var computerWins = 0;
    // Write code that plays 'Rock, Paper, Scissors' until either the player or the computer has won five times.
    /* YOUR CODE HERE */
    return [playerWins, computerWins];
}

@@ -2140,268 +2140,445 @@
     
-console.log(%22Let's play Rock, Paper, Scissors%22);%0A    var playerWins = 0;%0A    var computerWins = 0;%0A    // Write code that plays 'Rock, Paper, Scissors' until either the player or the computer has won five times.%0A    /* YOUR CODE HERE */%0A    return %5Bplay
+var playerWins = 0;%0A    var computerWins = 0;%0A    console.log(%22Let's play again%22);%0A    while ((playerWins %3C 5) %7C%7C (computerWins %3C 5)) %7B%0A        var playerMove = getPlayerMove();%0A        var computerMove = getComputerMove();%0A        var winner = getWinner(playerMove, computerMove);%0A%0A        if (winner === %22player%22) %7B%0A            playerWins = playerWins + 1;%0A        %7D%0A        else if (winner === %22computer%22) %7B%0A            comput
 erWins
-,
+ =
  com
@@ -2590,9 +2590,42 @@
 Wins
-%5D;%0A%7D
+ + 1;%0A        %7D%0A    %7D%0A%7D%0AplayToFive();
 %0A

update function playToFive