Rock paper scissors Game Python Source Code

Last updated Mar 19, 2021


If in Python

 

Rock paper scissors Game  is a multi-player game where we can play game each other in a rock, paper, scissor. The main agenda of the game is to determine what user will choose and win the game.
 

The principles are easy:

  1. Paper wins rock

  2. Rock wins scissors

  3. Scissors Gain within the paper

About the Project

The Rock paper scissors Game was built in python with a simple console application. The game will open a windowed where users can see the text character.  When user start the game it will prompt window tih select the options like Single Player, Two player, Exit game.

When Players selected they need to choose their guesing text to make challenge his opponent, they will choose character from the R,P,S (R for Rock, P for Paper, S for Scissor). The Rock paper scissors game is very simple, player just need to counter the opponent by chosen symbol. Try to guess and win the game with your opponent. The Rock paper scissors Game is simple game where your only goal is with over your enemy.

 

This Rock paper scissors game contains

  • Simple Design UI
  • User-friendly Interface
  • Easy Controls

 

Python Source Code

You will have to download & install the Python IDLE’s

import random
intro = "||RPS GAME (MULTIPLAYER)||"
rules = '''Enter 'R' for Rock, 'P' for Paper and 'S' for Scissor'''
menu = '''
1. Single Player
2. Two Player
3. Exit
'''
rpc = ['R', 'P', 'S']
chp = ['1', 'y', 'Y', 'yes', 'Yes', 'YES']

print(intro)

print(rules)


while(True):
   mode = int(input(menu))
   if mode==3:
      exit(0)
   user = input("Player 1: ")
   if user.upper() not in rpc :
      print("Invalid input. Try again.")
      continue
   else:
      user=user.upper()
   if mode==1:
      pc = random.choice(rpc)
      print("Computer :", pc)
   if mode == 2:
      pc = input("Player 2: ")
      if pc.upper() not in rpc:
         print("Invalid input. Try Again.")
         continue
      else:
         pc = pc.upper()
   if(mode==3):
      exit(0)
   if(user == pc):
      print("Draw")
   elif user=='R':
      if pc=='S':
         print("You won.")
      elif pc=='P':
         print("You lost.")
   elif user=='P':
      if pc=='S':
         print("You lost.")
      elif pc=='R':
         print("You won.")
   elif user=='S':
      if pc=='R':
         print("You lost.")
      elif pc=='P':
         print("You won.")

 

Output

Python Game Source code

 

 

Related

Python Online Job Portal Project Source Code

Library Management System Project in C++

Read More Python Examples

Tags: Python Source code, Python Game

 


Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

302 Views

Subscribe For Daily Updates

Flutter Questions
Android Questions