Today I am starting on The Odin Project Rock Paper Scissors assignment.
Understand the Problem
The game will be played between the user and the computer. The computer will be represented by the function computerPlay that will randomly return 'Rock', 'Paper', or 'Scissors'. The first function to write plays a single round of Rock Paper Scissors. The function should take two parameters, playerSelection and computerSelection, and then return a string that declares the winner of the round. The playerSelection parameter should be case-insensitive allowing the user to enter any variation, rock, RoCK, etc.
After testing the function, create a function called game(). The game() function utilizes the single round function to play a 5 round game that will keep score and return the final winner or loser at the end. The function will use console.log to return the winner or loser of each round. The prompt() will be used to get the input from the user.
Plan
This implementation of Rock Paper Scissors does not require a graphical interface so I don't have to worry about creating any additional HTML or CSS. The game will be played and results displayed in the console. The input will be entered from the user through the prompt for each round until the end of the 5 round game. The output will display the winner or loser of each round and lastly the final winner of the game. Each output will be using console.log().
Resources
The Odin Project
https://github.com/jennifertieuu/top-rock-paper-scissors
Top comments (0)