<commit_before>////////////////////////////////////////////////
/*   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.
    var x = move || getInput();
    // However, if `move` is not specified / is null, your expression should equal `getInput()`.
    return x /* Your Expression */;
}

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.
    var x = move || randomPlay();
    // However, if `move` is not specified / is null, your expression should equal `randomPlay()`.
    return x /* Your Expression */;
}

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.
    if (playerMove === computerMove){
        return "It's a tie.";
    }else if (playerMove === "rock"){
        if (computerMove === "scissors"){return "Player wins"} else { if (computerMove === "paper") {return "Computer wins"}}
    } else if (playerMove === "scissors") {
        if (computerMove === "paper"){return "Player wins"} else { if (computerMove === "rock") {return "Computer wins"}}
    }else if (playerMove === "paper"){
        if (computerMove === "rock"){return "Player wins"} else { if (computerMove === "scissors" {return "Computer wins"}
    }
    // 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 */
    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];
}
<commit_msg>added playtill5 changes to rps.js<commit_after>////////////////////////////////////////////////
/*   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.
    var x = move || getInput();
    // However, if `move` is not specified / is null, your expression should equal `getInput()`.
    return x /* Your Expression */;
}

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.
    var x = move || randomPlay();
    // However, if `move` is not specified / is null, your expression should equal `randomPlay()`.
    return x /* Your Expression */;
}

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.
    if (playerMove === computerMove){
        return "It's a tie.";
    }else if (playerMove === "rock"){
        if (computerMove === "scissors"){return "Player wins"} else { if (computerMove === "paper") {return "Computer wins"}}
    } else if (playerMove === "scissors") {
        if (computerMove === "paper"){return "Player wins"} else { if (computerMove === "rock") {return "Computer wins"}}
    }else if (playerMove === "paper"){
        if (computerMove === "rock"){return "Player wins"} else { if (computerMove === "scissors") {return "Computer wins"}
    }}
    // 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 */
    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 */
    var computerMove = getComputerMove();
    var playerMove = getPlayerMove();
    var winner = getWinner();
    for (var x = 1; x <=5; x++){
        if(winner === "Player wins"){return playerWins += 1;}
    else if (winner === "Computer wins"){ return computerWins += 1;}
    console.log("Player chose " + playerMove + " while Computer chose " + computerMove);
        return console.log("The score is currently " + playerWins + " to " + computerWins + '.')}

    return [playerWins, computerWins];
}

{'fraction_non_alphanumeric': 0.1907260111694026, 'fraction_numerical': 0.0035539008292435267, 'mean_word_length': 2.356047700170358, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3366502', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1547, 'n_words': 622}