GithubHelp home page GithubHelp logo

rpsproject's Introduction

Rock, Paper, Scissors Game (V sem Python Mini Project)

Overview

This is a simple Rock, Paper, Scissors game implemented in Python using the Tkinter library for the graphical user interface. The game allows a player to compete against the computer, keeping track of scores and updating the display accordingly.

Features

  • Graphical user interface built with Tkinter.
  • Interactive gameplay where the player can select rock, paper, or scissors.
  • Randomized computer choices.
  • Score tracking for both player and computer.
  • Visual feedback with images representing rock, paper, and scissors.

Prerequisites

  • Python 3.x
  • Tkinter library
  • PIL (Pillow) library for image handling

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-directory>
  2. Install the required libraries:

    pip install tkinter pillow
  3. Ensure the following directory structure for images:

    images/
    ├── paper_computer.png
    ├── paper_player.png
    ├── rock_computer.png
    ├── rock_player.png
    ├── scissor_computer.png
    ├── scissor_player.png
    

Usage

  1. Navigate to the project directory:

    cd <repository-directory>
  2. Run the game:

    python Source.py
  3. Gameplay Instructions:

    • Click on the buttons to select your move: Rock, Paper, or Scissors.
    • The computer will randomly select a move.
    • The scores will be updated based on the outcome of each round.
    • The first to reach 5 points wins the game.

Code Explanation

  • Import Statements:

    • tkinter is used for creating the GUI.
    • PIL (Pillow) is used for image handling.
    • randint from random is used for the computer's random choice.
  • GUI Setup:

    • The main window is created and configured with a title and background color.
    • Images are loaded and displayed for both player and computer choices.
    • Labels are used to display the score and player/computer indicators.
  • Functions:

    • updatemsg(message): Updates the final message label with the given message.
    • player_update(): Increments the player's score.
    • computer_update(): Increments the computer's score.
    • win_check(player_choice, computer_choice): Checks the outcome of the game and updates scores and messages accordingly.
    • choice_update(player_choice): Updates the displayed choices and checks the game outcome.
  • Buttons:

    • Buttons are created for each move (Rock, Paper, Scissors) with corresponding images and commands to handle player input.

Screenshots

Screenshot (119) Screenshot (128) Screenshot (129)

Contributing

Feel free to fork the repository and submit pull requests. Contributions are welcome!

rpsproject's People

Contributors

thanyarad avatar

Stargazers

Charishma Shivani avatar Shreyas avatar  avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.