I build all of the logic needed for a more intense version of Rock Paper Scissors (RPS).
Live demo here.
![preview preview](https://private-user-images.githubusercontent.com/91121660/270683195-be81894f-507c-4166-ad67-f3de74f8048e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjI5NTksIm5iZiI6MTczOTM2MjY1OSwicGF0aCI6Ii85MTEyMTY2MC8yNzA2ODMxOTUtYmU4MTg5NGYtNTA3Yy00MTY2LWFkNjctZjNkZTc0ZjgwNDhlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDEyMTczOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTliOTgzZDE0YjAxYWE0MDUwNDQwYzhiNTNiZTNmNDk4ZWQ0NGQ5ODFiYzVlYmFiZjM2NDlmYTFhNWM2OThlNzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.jVey7OhdnDPEefctdIPPngsPyTmf1MOYAMa0TCoV29Y)
In this project, I build all of the logic needed for a more intense version of Rock Paper Scissors (RPS). Rather than selecting just one of Rock, Paper, or Scissors - each player will select three moves. Each move will consist of a type (Rock, Paper, or Scissors) as well as a strength value. Each player will have 99 total points to use as strength between all three of their moves. For example, an example set of moves might be:
- Move 1: Rock - 30 Strength Points
- Move 2: Rock - 60 Strength Points
- Move 3: Paper - 9 Strength Points
The strength for each move must be at least 1.
After each player's moves are chosen, they will compare moves in the order they were selected. If two moves have different types (for example, Rock vs Scissors), then normal RPS rules will apply (in this case, Rock beats Scissors). However, if two types are the same, then the move with more strength will win. If both strength values are equal, then a tie is declared.
The player that wins the majority of the three rounds will be the winner of the game.
- HTML
- CSS
- JavaScript
- chai: 4
- mocha: 6
To complete this project, the code need to contain the following:
-
☑issue #2 Twelve global variables representing each player's move types and values (3 move types and 3 move values for each player). These variable names should be in the form of playerOneMoveOneType, playerOneMoveOneValue, etc.
-
☑issue #3 A function called setPlayerMoves, which will take a string representing a player (in the form of 'Player One' or 'Player Two'), three move types, and three move values, and set the correct global move variables. The method signature for this function should be as follows: setPlayerMoves(player, moveOneType, moveOneValue, moveTwoType, moveTwoValue, moveThreeType, moveThreeValue).
-
☑issue #4 A function called getRoundWinner, which takes a round number (1, 2, or 3), compares both player's move types and values for that round, and returns the appropriate winner ('Player One', 'Player Two', or 'Tie')
-
☑issue #5 A function called getGameWinner, which compares both player's move types and values for the whole game and returns the appropriate winner ('Player One', 'Player Two', or 'Tie')
-
☑issue #6 Bonus: A function called setComputerMoves, which chooses three random moves for player two. The move type for each move should be completely random, and the move values should be random but add up to 99.
This project comes from the Codecademy's 'Create a Back-End app with JavaScript' skill path.
Created by Simona Pizio