Skip to content

LuigiDeFacci/Rock-Paper-Scissors-Python-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Rock Paper Scissors Game

This is a simple rock paper scissors game implemented using Python and the tkinter module. The game allows the user to choose between rock, paper, and scissors and play against the computer. The rules of the game are defined in a dictionary, and the score is kept track of using variables.

How to Play

  1. Clone or download the repository.
  2. Open the terminal and navigate to the directory where the file is located.
  3. Run the following command to start the game:
  4. python rock_paper_scissors.py
  5. A window will appear with the game interface.
  6. Click on the "Rock", "Paper", or "Scissors" button to make your choice.
  7. The computer will randomly choose its option.
  8. The result of the game will be displayed in the "Result" section and the scores will be updated accordingly in the "User" and "Computer" sections.

Code Explanation

The game code is implemented in Python and uses the tkinter module to create a GUI. The game logic is implemented in the play() function which takes the user's choice as an argument. The function selects a random choice for the computer and then uses the rules dictionary to determine the result of the game. Depending on the result, the score and the result label are updated.

The GUI is created using the Tk() function from the tkinter module. The labels and buttons are created using the Label() and Button() functions respectively. The buttons are bound to the play() function using the command parameter.

Finally, the mainloop() of the window is started using the function which waits for user input and updates the window accordingly.

About

Rock Paper Scissors Python Game using Thinker interface.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages