Rock Paper Scissors GUI

Rock Paper Scissors GUI Screenshot

Project Overview

This Rock Paper Scissors project is a graphical user interface (GUI) game built using Python with Tkinter. The game allows users to play the classic Rock Paper Scissors game against the computer. The project demonstrates the use of Tkinter for creating interactive GUI applications and JSON for data persistence.

Interactive Demo

Try out the Rock Paper Scissors game below. Enter your name, choose your move, and play against the computer!

Welcome to Rock Paper Scissors!
Game Over!
Rock Paper Scissors
You: 0 | Computer: 0
Your Choice
?
VS
Computer's Choice
?
Choose rock, paper, or scissors to start!
🪨
📄
✂️

Features

Player Personalization

Enter your name to personalize the game experience and keep track of your scores.

Interactive GUI

Intuitive graphical interface with emoji buttons makes the game engaging and easy to play.

Score Tracking

Keeps track of wins, losses, and ties with persistence between game sessions.

Smart Computer AI

Computer opponent uses randomized selection to ensure fair and unpredictable gameplay.

Save Progress

Save your game progress and statistics to continue from where you left off.

Reset Option

Reset the game scores and start fresh when you want a new challenge.

Welcome Screen

The game starts with a welcome screen where users can enter their name and choose to start a new game. The interface is designed to be user-friendly and intuitive.

Welcome Screen

Gameplay

During the game, users select Rock, Paper, or Scissors by clicking the corresponding emoji buttons. The computer randomly selects its choice, and the result is displayed on the screen. The game keeps track of the user's score and the computer's score, with the first to reach 3 points being declared the champion.

Gameplay Screen

Key Features

Game Over Screen

When a player reaches 3 points, a game over message is displayed indicating the winner. Players can then restart the game to play again.

Game Over Screen

Technical Details

RockPaperScissors.py

This file contains the entire implementation of the game:

def determine_winner(user_choice, computer_choice): if user_choice == computer_choice: result = "It's a tie!" elif (user_choice == 'rock' and computer_choice == 'scissors') or \ (user_choice == 'paper' and computer_choice == 'rock') or \ (user_choice == 'scissors' and computer_choice == 'paper'): self.user_score += 1 result = "You win!" else: self.computer_score += 1 result = "Computer wins!" self.save_scores() return result
def play(self, choice): if self.user_score < 3 and self.computer_score < 3: computer_choice = self.get_computer_choice() result = self.determine_winner(choice, computer_choice) self.result_label.config(text=f"Computer chose: {computer_choice}\n{result}") self.update_score_label() if self.user_score == 3: self.user_wins += 1 self.result_label.config(text=f"🎉 {self.user_name} are the champion! 🎉") self.disable_buttons() elif self.computer_score == 3: self.result_label.config(text="😢 Computer is the champion! 😢") self.disable_buttons() else: self.restart_game()

How to Play

  1. Open the game and enter your name (optional).
  2. Select Rock, Paper, or Scissors by clicking the corresponding emoji button.
  3. The computer will make its choice, and the result will be displayed on the screen.
  4. The first player to reach 3 points wins the game.
  5. You can save your progress, restart the current game, or reset everything at any time.

Development Process

The Rock Paper Scissors game was developed using Python with a focus on creating a user-friendly interface:

Back to Projects