Facebook Pixel

Rock Paper Scissor

React.js
medium
30 mins

Things to do

  • Choose between Rock, Paper, or Scissors.
  • Computer randomly chooses one of the three options.(rock, paper, or scissor)
  • Determine the result as:
    • Rock beats Scissors
    • Scissors beats Paper
    • Paper beats Rock
  • Default result should be "Press Any One"
  • Show the winner as (You Win, You Lose, It’s a Tie).
  • Maintain and display both Player and Computer scores.
    • By default the score should be 0 for both the player and computer
  • Add a Reset button to restart the game and reset the scores.
    • After reset all states (choices, scores, and result) should return to their default values.

Instructions

Please use the following data-testid attributes in your React component:

  • btn-rock → for the Rock Button
  • btn-paper → for the Paper Button
  • btn-scissor → for the Scissor Button
  • player-choice → for the Player Choice
  • computer-choice → for the Computer Choice
  • result → for the Result
  • player-score → for the Player Score
  • computer-score → for the Computer Score
  • reset → for the Reset Button
Preview what you need to build

Solve Similar questions 🔥

Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.