Skip to content

Latest commit

 

History

History
44 lines (24 loc) · 2.17 KB

File metadata and controls

44 lines (24 loc) · 2.17 KB

Rock - Paper - Scissor

I have developed a rock-paper-scissors game in Python. The game allows two players to compete against each other by selecting either rock, paper, or scissors. The rules of the game are as follows:

1. Rock beats scissors: If one player chooses rock and the other chooses scissors, the player with rock wins.

2. Scissors beat paper: If one player chooses scissors and the other chooses paper, the player with scissors wins.

3. Paper beats rock: If one player chooses paper and the other chooses rock, the player with paper wins.

Features of the Rock-Paper-Scissors Game:

1. Player Input: The game prompts each player to input their choice (rock, paper, or scissors) through the command line interface.

2. Randomized Computer Player: If only one player is participating, the other player's choice is randomized by the computer.

3. Determining the Winner: The game evaluates the choices made by both players and determines the winner based on the rules mentioned above.

4. Displaying Results: The game displays the choices made by each player and announces the winner or a tie.

5. Replay Option: After a game is finished, players can choose to play again or exit the game.

How it Works:

1. Player Input: The game prompts the players to enter their choice (rock, paper, or scissors) one by one.

2. Randomized Computer Player: If only one player is participating, the computer randomly selects its choice (rock, paper, or scissors).

3. Determining the Winner: The game compares the choices made by the players and determines the winner based on the rules of the game.

4. Displaying Results: The game displays the choices made by each player and announces the winner or a tie.

5. Replay Option: After displaying the results, the game asks the players if they want to play again. If yes, the game starts over from step 1. If not, the game exits.

Example Gameplay:

Player 1: Please enter your choice (rock, paper, or scissors): rock

Player 2: Please enter your choice (rock, paper, or scissors): paper

Player 1 chose rock. Player 2 chose paper.

Paper beats rock. Player 2 wins!

Do you want to play again? (yes/no): ______