forked from thisisshub/HacktoberFest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
En19cs306027_Lovesh_Kumrawat_Stone-Paper-Scissor.py
59 lines (55 loc) · 2.71 KB
/
En19cs306027_Lovesh_Kumrawat_Stone-Paper-Scissor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Program to play Stone, Paper, Scissor
import random
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Stone-Paper-Scissor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
name=input('Enter your name: ').capitalize()
while True:
# sps=[' '*39+'Computer'+(' '*47).replace(' '*(int(len(name)/2)),name),[
sps=[' '*39+'Computer'+' '*10+' '*(37-int(len(name)/2))+name,[
' ',
' ______________ ',
' |//////////////|',
' |//////////////|',
' |/////Stone////|',
' |//////////////|',
' |______________|',
' ',
' '
],[
' ',
' ______________ ',
' | |',
' | |',
' | Paper |',
' | |',
' |______________|',
' ',
' '
],[
' __ ',
' |__| __ ',
' \\ / ',
' \\ / ',
' Scissor\\/ ',
' /\\ ',
' / \\ ',
' __ / \\__ ',
' |__| '
]]
print('1) Stone\n2) Paper\n3) Scissor')
ran=random.choice([1,2,3])
inp=int(input('Enter the Option number: '))
if ran==inp:
result='Match Draw'
elif (ran,inp)==(1,2) or (ran,inp)==(2,3) or (ran,inp)==(3,1):
result=' You Won '
elif (ran,inp)==(3,2) or (ran,inp)==(2,1) or (ran,inp)==(1,3):
result=' You Lose '
print(sps[0])
for i in range(9):
print(f'{sps[ran][i]}',end='')
(print(' '*13+result+' '*12,end=''),print(f'{sps[inp][i].lstrip()}')) if i==4 else print(f'{sps[inp][i]}')
try:
if int(input('\nTo play the Game Again Press "1" & "0" to Quit: '))!=1:
exit('\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Thank You~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
except:
exit('\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Thank You~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')