- Create 3 Files (1 HTML, 1 JavaScript, & 1 CSS)
- Set up HTML file first.
!
+TAB
. - Create an H1 tag with RPS as the Header and a container to hold everything
- Make sure that IDs are add to the divs with the notion we will go back and add css AND needing to target things for DOM Scripting
- Build out status bar with 3 buttons for Rock, Paper, and Scissors
- Build a Start Button
- Making sure we have connectable IDs on the HTML, Start by connecting the DOM elements in the JS with
.getElementById
and creating an array for storing player moves with agetElementByClassName()
- Then set up an event listener for the start button
- Start creating game variables for scores and timers while also create reference variables for the game to look at a create further logic around.
- Start fleshing out the start game function that starts the game once the start button is clicked.
- Target the status Bar to alert the player that the game will start in 3 seconds
- Leave space to add timer functionality upon startup
- Create a function to count up to 3, on 4 it says go and clears the interval and enables the RPS buttons for gam
- This should start by randomly generating a move from the moves array
- Then when button is clicked for the turn, it disables the buttons entirely
- THis will also display both the player move and comp move.
- More this on a minute so leave space to come back and add functionality
- Create a function where you pass the player and comp through as arguments where you will compare these variables and determine whose the winner based on an alg that looks like this
((moveMap[comp] - moveMap[player] + 3) % 3 === 1)
- This formula checks to determine and declare winner, turning into to string to run through IF statement in playerTurn Function
- With the winner assigned to a variable, we can now run it through an IF ELSE statement to display the appropiate winner
- This should then enable the previously disable start button and awards a point to the winner that will be display for as many games that are played.
- You do you