// Array that holds game choices
// Uses an array of strings since it seems sort of redundant to create separate 
// variables for each and store them in an array
var gameChoices = ["Rock", "Paper", "Scissors"];

// Create a variable to store a random number between 0 and 2 for the player
var randomPlayerNum = Math.floor(Math.random() * 3);
// Create a variable to store a random number between 0 and 2 for the computer
var randomComputerNum = Math.floor(Math.random() * 3);

// Log random numbers (for debugging)
console.log("randomPlayerNum: " + randomPlayerNum);
console.log("randomComputerNum: " + randomComputerNum);

// Game logic
// If the results of the random numbers are the same, it's a tie
if (gameChoices[randomPlayerNum] == gameChoices[randomComputerNum]) {

    // Print game result with one of the choices (since they're both the same)
    console.log("The Player and the Computer both chose " + gameChoices[randomComputerNum] + ". It's a tie!");

    // If the results are Rock vs. Paper (Player and Computer, respectively)
} else if (gameChoices[randomPlayerNum] == "Rock" && gameChoices[randomComputerNum] == "Paper") {

    // Print game result as Computer win
    console.log("The Player chose Rock and the Computer chose Paper. The Computer wins!");

    // If the results are Rock vs. Scissors (Player and Computer, respectively)
} else if (gameChoices[randomPlayerNum] == "Rock" && gameChoices[randomComputerNum] == "Scissors") {

    // Print game result as Player win
    console.log("The Player chose Rock and the Computer chose Scissors. The Player wins!");

    // If the results are Paper vs. Rock (Player and Computer, respectively)
} else if (gameChoices[randomPlayerNum] == "Paper" && gameChoices[randomComputerNum] == "Rock") {

    // Print game result as Player win
    console.log("The Player chose Paper and the Computer chose Rock. The Player wins!");

    // If the results are Paper vs. Scissors (Player and Computer, respectively)
} else if (gameChoices[randomPlayerNum] == "Paper" && gameChoices[randomComputerNum] == "Scissors") {

    // Print game result as Computer win
    console.log("The Player chose Paper and the Computer chose Scissors. The Computer wins!");

    // If the results are Scissors vs. Rock (Player and Computer, respectively)
} else if (gameChoices[randomPlayerNum] == "Scissors" && gameChoices[randomComputerNum] == "Rock") {

    // Print game result as Computer win
    console.log("The Player chose Scissors and the Computer chose Rock. The Computer wins!");

    // If the results are Scissors vs. Paper (Player and Computer, respectively), which is the only remaining combination
} else {

    // Print game result as Player win
    console.log("The Player chose Scissors and the Computer chose Paper. The Player wins!");

}