V.Vidhya Logo

V.Vidhya

Rock-Paper-Scissors Game


Build a text-based Rock-Paper-Scissors game where the player competes against the computer.

Instructions

You will evolve your game program in stages gradually.

  • Unfair Computer:
    • Prompt the player to choose “rock,” “paper,” or “scissors.” and then computer make a choice based on the player’s choice such that the computer always defeats the human player.
  • Fair Chances:
    • Now to make the game fair, computer should make a truly random choice.
  • Endless Game:
    • A single game is never enough. So, make the game such that the player can play indefinitely until they choose to quit.
    • Keep track of wins, losses and ties across rounds and display the running score after each round.
Expected Output

(Note: This is the full version of the game output with all the features implemented.)

### Rock-Paper-Scissors ###
(Type 'quit' at any time to exit.)

Choose rock, paper, or scissors (or 'quit' to exit): rock
Computer chose: rock
This round is a tie.

# Score #
You: 0 | Computer: 0 | Ties: 1

Choose rock, paper, or scissors (or 'quit' to exit): paper
Computer chose: scissors
You lose this round.

# Score #
You: 0 | Computer: 1 | Ties: 1

Choose rock, paper, or scissors (or 'quit' to exit): lizard
Invalid choice. Please enter rock, paper, or scissors.
Choose rock, paper, or scissors (or 'quit' to exit): scissors
Computer chose: paper
You win this round!

# Score #
You: 1 | Computer: 1 | Ties: 1

Choose rock, paper, or scissors (or 'quit' to exit): quit

Thanks for playing!

# Final Score #
You: 1 | Computer: 1 | Ties: 1


Feel free to implement additional features to enhance the gameplay.


Prev Post
Loan Calculator
Next Post
Bill Splitter