Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Domains/CompetitiveProgramming/Programs/Python/rockpaper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
**contributor** honey-khatri

# ✊✋✌️ Rock Paper Scissors — Python Console Game

This is a simple and interactive Rock-Paper-Scissors game built in Python. It runs in the console and lets you play against the computer with ASCII art visuals for each move. Great for beginners learning Python basics like loops, conditionals, and input handling.

---

## 🎮 How to Play

- Run the script in any Python environment.
- Choose your move by typing:
- `0` for Rock
- `1` for Paper
- `2` for Scissors
- The computer randomly selects its move.
- The game displays both choices using ASCII art and announces the winner.
- You can play multiple rounds until you choose to exit.

---

## 🛠️ Requirements

- Python 3.x
- No external libraries needed

---

## 📦 Installation & Run

1. Clone the repository:
```bash
git clone https://github.com/honey-khatri/rock-paper-scissors.git
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import random

rock = """
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
"""

paper = """
_______
---' ____)____
______)
_______)
_______)
---.__________)
"""

scissors = """
_______
---' ____)____
______)
__________)
(____)
---.__(___)
"""

game_images = [rock, paper, scissors]

while True:
user_choice_input = input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors: ")

try:
user_choice = int(user_choice_input)
except ValueError:
print("Invalid input. Please type 0, 1, or 2.")
continue

if user_choice < 0 or user_choice >= 3:
print("You typed an invalid number, you lose!")
else:
print("You chose:")
print(game_images[user_choice])

computer_choice = random.randint(0, 2)
print("Computer chose:")
print(game_images[computer_choice])

if user_choice == computer_choice:
print("It's a draw!")
elif (user_choice == 0 and computer_choice == 2) or \
(user_choice == 1 and computer_choice == 0) or \
(user_choice == 2 and computer_choice == 1):
print("You win!")
else:
print("You lose!")

play_again = input("Do you want to play again? (yes/no): ").lower()
if play_again != 'yes':
break
Loading