Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rock paper scissor #92

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 209 additions & 0 deletions Rock paper and scissior
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# Code by - Siphyshu
# Last Modified: 07-06-2020

import random
import time
from os import system

# Standard Rock, Paper, Scissor Rules apply:
# 1. Stone > Scissor
# 2. Stone < Paper
# 3. Scissor > Paper
#
# Notations:
# 0 - Nothing,
# R - Rock,
# P - Paper,
# S - Scissor

rock = """
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
"""

paper = """
_______
---' ____)____
______)
_______)
_______)
---.__________)
"""

scissor = """
_______
---' ____)____
______)
__________)
(____)
---.__(___)
"""

def main():
choices = {'R':rock, 'P':paper, 'S':scissor}
# choices = {'R':'ROCK', 'P':'PAPER', 'S':'SCISSOR'}
m_score, p_score = 0, 0
while (m_score != 3) and (p_score != 3):
system('cls')
print("ROCK, PAPER & SCISSORS!")
print(f"\n[Player({p_score}) vs. Machine({m_score})]")

p_choice = ''
print("\n[PLAYER'S TURN]")
playerturn = input("(R)ock, (P)aper or (S)cissor: ").upper()
if playerturn == "R":
p_choice = 'R'

elif playerturn == 'P':
p_choice = 'P'

elif playerturn == "S":
p_choice = 'S'

else:
continue

m_choice = random.choice(['R','P','S'])
print("\n[MACHINE'S TURN]")
loading()

system('cls')
print("ROCK, PAPER & SCISSORS!")
print(f"\n[Player({p_score}) vs. Machine({m_score})]")
print(f"\nYOU DREW: {choices[p_choice]}")
print(f"MACHINE DREW: {choices[m_choice]}")



outcome = win_checker(p_choice, m_choice)

if outcome == False:
print("\n[NO POINT AWARDED]")

elif outcome == p_choice:
p_score += 1
print("\n[POINT TO PLAYER]")

elif outcome == m_choice:
m_score += 1
print("\n[POINT TO MACHINE]")

input("\n[Press ENTER]")

system('cls')
print("ROCK, PAPER & SCISSORS!")
print(f"\n[SCORE: Player({p_score}) vs. Machine({m_score})]")

if p_score == 3:
print("\n[PLAYER WINS!]")
print(r'''
$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$
$$$'`$$$$$$$$$$$$$'`$$$$$
$$$$ $$$$$$$$$$$ $$$$$$
$$$$. `$' \` \$` $$$$$$$
$$$$$. !\ i i .$$$$$$$$
$$$$$$ `--`--.$$$$$$$$$
$$$$$$L `$$$$$^^$$
$$$$$$$. .' ""~ $$$
$$$$$$$$. ; .e$$$$$
$$$$$$$$$ `.$$$$$$$$$$$
$$$$$$$$ .$$$$$$$$$$$$
$$$$$$$ $$$$$$$$$$$$$''')

elif m_score == 3:
print("\n[MACHINE WINS!]")
print(r'''
,---------------------------,
| /---------------------\ |
| | | |
| | Machines | |
| | Rules | |
| | Humans | |
| | | |
| \_____________________/ |
|___________________________|
,---\_____ [] _______/------,
/ /______________\ /|
/___________________________________ / | ___
| | | )
| _ _ _ [-------] | | (
| o o o [-------] | / _)_
|__________________________________ |/ / /
/-------------------------------------/| ( )/
/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ /
/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ /
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''')

time.sleep(3)

choose()




def win_checker(p1,p2):
if p1 == p2:
return False

if p1 == 'R':
if p2 == 'P':
return p2

else:
return p1

if p1 == 'P':
if p2 == 'S':
return p2

else:
return p1

if p1 == 'S':
if p2 == 'R':
return p2

else:
return p1




def choose():
while True:
ask = input("\n[Play Again? (Y/N)]: ").upper()

if ask == 'Y':
main()

elif ask == 'N':
print("\n[EXITING]")
time.sleep(3)
break

else:
pass




def loading():
print("[", end="")

for _ in range(0,25):
time.sleep(0.05)
print("█", end="", flush=True)


print("]")




if __name__ == "__main__":
main()