Skip to content
Open
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
170 changes: 170 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# **Rock Paper Scissors Game ✂️🪨📄**

A fun and simple Rock Paper Scissors game built in Python! 🎮 Challenge the computer and keep track of your wins, losses, and ties in this classic game of strategy and luck. 🚀





## **Overview 🌟**

This Python script lets you play Rock Paper Scissors against the computer. 🖥️ It uses basic Python features like loops, conditionals, and random number generation to create an engaging, console-based game. Perfect for beginners learning Python or anyone looking for a quick game! 😄

##

## **Features ✅**



**Interactive Gameplay:** Choose Rock 🪨, Paper 📄, or Scissors ✂️ to compete against the computer.

**Score Tracking:** Displays your wins 🏆, losses 😔, and ties 🤝 after each round.

**Simple Controls:** Enter R, P, S, or Q to play or quit. 🕹️

**Random Computer Moves:** The computer picks randomly for fair gameplay. 🎰

**Exit Anytime:** Type Q to quit the game. 🚪



## **How to Play 🎲**



**Run the Python script. 🐍**

View your current score (wins, losses, ties). 📊

Enter your move:

R for Rock 🪨

P for Paper 📄

S for Scissors ✂️

Q to quit 🚪





The computer randomly selects its move. 🤖

The game shows both moves and declares the result (win 🏆, loss 😔, or tie 🤝).

Keep playing or quit when you’re done! 😎



## **Rules**



🪨 Rock beats ✂️ Scissors

✂️ Scissors beats 📄 Paper

📄 Paper beats 🪨 Rock

Same moves result in a tie 🤝



## **Installation 🛠️**

To play the game, you need Python installed. Follow these steps:



**Download the Script:**



Save the rock\_paper\_scissors.py file to your computer. 💾

Alternatively, clone the repository (if hosted):git clone https://github.com/aviralshukla12/Python







**Check Python Installation:**



Ensure Python 3.x is installed:python --version









**Run the Game:**



Navigate to the script’s directory and run:python rock\_paper\_scissors.py





##

## **Usage ▶️**



After starting the game, follow the prompts to input your move. The game displays your choice, the computer’s choice, and the result. Your score updates after each round. Type Q to exit. 🏁



**Example output:**

Let's Play ROCK PAPER SCISSORS GAME! 🎉

Current streak: 0 Wins, 0 Losses, 0 Ties 📊

Type 'Q' to quit

'R' for ROCK, 'P' for PAPER, 'S' for SCISSORS

R

ROCK versus... 🪨

PAPER 📄

It's a loss! 😔



## **Contributing 🤝**

Want to improve the game? Awesome! 😊 To contribute:



Fork the repository. 🍴

Create a branch (git checkout -b feature-cool-idea).

Make your changes and test them. 🧪

Commit your changes (git commit -m "Added cool feature"). 📝

Push to your branch (git push origin feature-cool-idea). 🚀

Open a pull request. 🙌





55 changes: 30 additions & 25 deletions stone-paper-sssc.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import random, sys

print("Let's Play ROCK PAPER SCISSORS GAME!")

# Integrating round of 5 game
wins = 0
losses = 0
ties = 0
computer_wins = 0
player_wins = 0
max_rounds = 5
current_round = 0


while True:

while current_round<max_rounds and computer_wins <3 and player_wins < 3:
current_round += 1
print("\nRound %s of %s" % (current_round, max_rounds))
print("Current streak: %s Wins, %s Losses, %s Ties" % (wins, losses, ties))
while True:
print("Type 'Q' to quit \n'R' for ROCK, 'P' for PAPER, 'S' for SCISSORS")
playermove = input().upper()
if playermove == "Q":
sys.exit()
if playermove == "R" or playermove == "P" or playermove == "S":
break

print("Type 'Q' to quit \n'R' for ROCK, 'P' for PAPER, 'S' for SCISSORS")
playermove = input().upper()
if playermove == "Q":
sys.exit()

if playermove == "R":
print("ROCK versus...")
Expand All @@ -37,23 +43,22 @@
if playermove == compMove:
print("It's a tie!")
ties += 1
elif playermove == "R" and compMove == "P":
print("It's a loss!")
losses += 1
elif playermove == "R" and compMove == "S":
elif (playermove == "R" and compMove == "S") or (playermove == "P" and compMove == "R") or (playermove == "S" and compMove == "P"):
print("It's a win!")
wins += 1
elif playermove == "P" and compMove == "S":
print("It's a loss!")
losses += 1
elif playermove == "P" and compMove == "R":
print("It's a win!")
wins += 1
elif playermove == "S" and compMove == "R":
player_wins += 1
else:
print("It's a loss!")
losses += 1
elif playermove == "S" and compMove == "P":
print("It's a win!")
wins += 1
else:
print("Thanks for trying my game")
computer_wins += 1
print(f"{current_round} Round Score - You: {player_wins}, Computer: {computer_wins}")

# Declaring the final winner
if player_wins > computer_wins:
print("\nYou won the Best of 5 matches! 🏆")
elif computer_wins > player_wins:
print("\nComputer won the Best of 5 matches! 😔")
else:
print("\nThe match ended in a tie! 🤝")

print(f"Final Game Stats: {wins} Wins, {losses} Losses, {ties} Ties")