Rock, Paper, Scissors is a classic hand game that is often played between two people. This project is an implementation of the game in Python, allowing a user to play against the computer.
The project is organized into several files:
main.py
: The entry point that initializes and runs the game.game.py
: Contains theGame
class with the main logic for Rock, Paper, Scissors.art.py
: Contains the ASCII art for the game's logos.
- Python 3.x
-
Clone the repository:
git clone https://github.com/thiagosnuness/rock_paper_scissors.git cd rock_paper_scissors
-
Run the main script:
python main.py
-
Follow the on-screen instructions to play.
This script is the entry point for the game. It runs the game and handles user interactions.
- Functionality:
- Clears the console.
- Prompts the user to start a new game.
- Handles multiple rounds of Rock, Paper, Scissors until the user chooses to exit.
- Validates user input to ensure valid choices are made.
This file defines the Game
class, which manages the game flow, including:
-
Attributes:
__logos
: List of ASCII art for the game choices (Rock, Paper, Scissors).__user_choice
: The choice made by the user.__computer_choice
: The choice made by the computer (randomly selected).
-
Methods:
__init__(self, user_choice)
: Initializes the game with the user's choice and a random computer choice.get_logo(self, choice)
: Returns the ASCII art for the given choice.determine_winner(self)
: Determines and displays the winner based on standard Rock, Paper, Scissors rules.
This file contains the ASCII art for the Rock, Paper, Scissors logos.
- Logos:
rock
: ASCII art for Rock.paper
: ASCII art for Paper.scissors
: ASCII art for Scissors.
- Fork the repository.
- Create a branch for your feature (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.