<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) {
if (move) {
    return move
} else {
    return getInput(); 
    }
}

function getComputerMove(move) {
    if (move) {
    return move
} 
    else {
    return randomPlay(); 
    }
}

function play(playerMove,computerMove) {
    var playerTurn = getPlayerMove(playerMove);
    var computerTurn = getComputerMove(computerMove);

if(playerTurn === computerTurn) {
    return "The result is a tie!";
}

else if(playerTurn === "rock") {
        
    if(computerTurn === "scissors") {
        return "rock wins";  
    }
    else {
        return "paper wins";    
    }

}

else if(playerTurn=== "paper") {
        
    if(computerTurn === "rock") {
        return "paper wins";  
    }
    else {
        return "scissors wins";    
    }

}

else if(playerTurn === "scissors") {
        
    if(computerTurn === "paper") {
        return "scissors wins";  
    }
    else {
        return "rock wins";    
    }

    }

}

play("rock");


//STILL WORKING ON THIS//
/*function playToFive() {
    console.log("Let's play Rock, Paper, Scissors");
    for (var playerWins = 0; playerWins <5; playerWins++){
        console.log(playerWins)
    }
    for (var computerWins = 0;computerWins <5;computerWins++){
        console.log(computerWins)
    }
    
    //  Write code that plays 'Rock, Paper, Scissors' until either the player or the computer has won five times.
    /* YOUR CODE HERE 
    return [playerWins, computerWins];
}
    /* YOUR CODE HERE */
<commit_msg>Update rockpaperscissors.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) {
if (move) {
    return move
} else {
    return getInput(); 
    }
}

function getComputerMove(move) {
    if (move) {
    return move
} 
    else {
    return randomPlay(); 
    }
}

function play(playerMove,computerMove) {
    var playerTurn = getPlayerMove(playerMove);
    var computerTurn = getComputerMove(computerMove);

if(playerTurn === computerTurn) {
    return "The result is a tie!";
}

else if(playerTurn === "rock") {
        
    if(computerTurn === "scissors") {
        return "player";  
    }
    else {
        return "computer";    
    }

}

else if(playerTurn=== "paper") {
        
    if(computerTurn === "rock") {
        return "player";  
    }
    else {
        return "computer";    
    }

}

else if(playerTurn === "scissors") {
        
    if(computerTurn === "paper") {
        return "player";  
    }
    else {
        return "computer";    
    }

    }

}



function playToFive() {
    console.log("Let's play Rock, Paper, Scissors");
    var playerWins = 0;
    var computerWins = 0;
    var winner;
    var playerMove;
    var computerMove;
    
    while (playerWins < 5 && computerWins < 5) {
        playerMove = getPlayerMove();
        computerMove = getComputerMove();
   
        winner = play(playerMove, computerMove);

        if (winner === "player") {
            playerWins +=1;
            console.log("joy! you, the player, have won!");
        }
        else if (winner === "computer") {
            computerWins +=1;
            console.log("sadness--the computer has won.");
        }
        else if (playerMove === computerMove) {
            console.log("A tie. No one has one. Play another round?");
        }
    
    console.log("Player played " + playerMove +  " and computer played " + computerMove +".");
    console.log("The score is player " + playerWins + " and Computer " + computerWins + ".");
       
        }
    

    return [playerWins, computerWins];
    
    }


playToFive();
{'fraction_non_alphanumeric': 0.2033477991320521, 'fraction_numerical': 0.0045463938830336845, 'mean_word_length': 1.6740331491712708, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2821915', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1371, 'n_words': 356}