Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Rock Paper Scissors is a guessing game played between two people, Player 1 (P1) and Player 2 (P2). Each player has three buttons, namely
Rock Paper Scissors is a guessing game played between two people, Player 1 (P1) and Player 2 (P2). Each player has three buttons, namely rock, paper, and scissors. The player makes a choice among the three buttons and chooses one. The other player does the same with his set of buttons at the same time. Depending on the choices they make the game ends with one of the players winning or a tie. The Rules are as follows: P1 wins if 1. P1 chooses rock and P2 chooses scissors or 2. P1 chooses paper and P2 chooses rock or 3. P1 chooses scissors and P2 chooses paper. I P2 wins if 1. P1 chooses rock and P2 chooses paper or 2. P1 chooses paper and P2 chooses scissors or 3. P1 chooses scissors and P2 chooses rock. Every other case is a tie. Design a circuit that implements the game. Each player gets 3 switches. There are 2 outputs indicating which player has won; connect the outputs to green LEDs. If there is a tie, both green LEDS must be off. Also, if any player presses more than one switch, a red LED for that player has to turn on, indicating the cheating.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
C implementation of the above approach include using namespace std Function that returns 1 if first player wins 0 in case of a draw and 1 if second player wins int comparechar first char second If bot...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started