-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
160 lines (140 loc) · 4.09 KB
/
Copy pathapp.py
File metadata and controls
160 lines (140 loc) · 4.09 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import sys
import random
import time
#from package import progress as pg #functions and packages
def progress():
animation = "|/-\\"
for i in range(100):
time. sleep(0.01) #
sys. stdout. write("\r" + animation[i % len(animation)])
sys
def typing(txt):
for word in txt:
print(word, end='')
sys.stdout.flush()
time.sleep(0.05)
return('')
def speed(txt):
for word in txt:
print(word, end='')
sys.stdout.flush()
time.sleep(0.03)
print('')
def loading(text, delay=0.2):
print(end=text)
n_dots = 0
count = 9
while count > 0:
if n_dots == 3:
print(end='\b\b\b', flush=True)
print(end=' ', flush=True)
print(end='\b\b\b', flush=True)
n_dots = 0
else:
print(end='.', flush=True)
n_dots += 1
count-=1
time.sleep(delay)
typing("\n\t\t**RULES FOR THE GAME**\n\t1.) Do not enter anything that is not in list below, \tdoing so will give your opponet a score\n\t2) just enjoy playing")
#list
game_tools = ["rock","paper","scissors"]
game_kit = ['name',"rock","paper","scissors"]
bot_win_exp = 'hahaha yippee am the best at this game hallelujah dub this ain\'t the last one '
#string
typing(f'\n\n\tlist: {game_kit}')
usr = input('\nEnter your name: ')
progress()
typing('\nMy name is bot')
#int
bot =0
usr_score=0
pattern = 10 * "*"
#count
gamecount = True
count = int(input(('\nhow many rounds do you wish to have? ')))
progress()
#loops
while gamecount:
typing(f'\n{usr}:{usr_score} \t\t bot:{bot} \t remaining:{count} rounds')
usr_prompt = input(typing('\nits your turn> '))
bot_prompt = random.choice(game_tools)
count -= 1
if count < 1:
gamecount = False
# if,elif and else statements
if usr_prompt == bot_prompt:
progress()
typing(f'\n{usr_prompt} and {bot_prompt}')
time.sleep(1)
typing('\njudge: ')
loading('typing\n')
progress()
typing('\n damn!, it\'s a draw')
bot += 1
usr_score += 1
elif usr_prompt != bot_prompt:
loading('loading')
typing('\ni think you can win\n')
progress()
typing(f'\n{usr}: {usr_prompt}\n bot:{bot_prompt}')
if usr_prompt == 'rock'and bot_prompt == 'paper':
print('\nbot typing ...')
progress()
typing('\npaper covers rock, i win')
bot += 1
elif usr_prompt == 'paper' and bot_prompt == 'rock':
typing(f'\nbot: you just got luck {usr}!')
usr_reply = input(f'\n{usr}: ')
progress()
typing('\nbot: ok kid next round am taking you down.')
usr_score += 1
elif usr_prompt == 'rock' and bot_prompt == 'scissors':
typing(f'\njudge: {usr} your rock can\'t be cut by bot\'s {game_tools[-1]}\n')
progress()
typing(f'\nbot: you just got lucky {usr}!')
print('...')
progress()
usr_reply = input(f'\n{usr}: ')
print('...')
progress()
typing('\nbot: ok kid next round am taking you down.')
usr_score += 1
elif usr_prompt == 'scissors' and bot_prompt =='rock':
typing(f'\nbot: this game is mine {usr}')
print('...')
progress()
usr_reply = input(f'\n{usr}: ')
print('...')
progress()
typing('\nbot: here i go again')
bot += 1
elif usr_prompt == 'paper' and bot_prompt == 'scissors':
typing('\nbot: let me first cut you into pieces')
print("...")
progress()
usr_reply = input(f'\n{usr}: ')
print("...")
progress()
typing('bot: ok')
bot += 1
elif usr_prompt == 'scissors' and bot_prompt == 'paper':
typing(f'\nbot: i dare you to cut me {usr}')
print('...')
progress()
usr_reply = input(f'\n{usr}: ')
print("...")
progress()
typing('\nbot: ok')
usr_score += 1
elif usr_prompt not in game_tools:
typing('\ninvalid entry')
bot += 1
if usr_score > bot:
typing(f'\n{usr}: {usr_score}\n\t\t{pattern} {usr} wins {pattern}\n')
typing(' rock-paper-scissors game developed by John Delvin from Solo learn\n\tbeginners can try reading my code')
exit()
else:
typing(f'\nbot: {bot}\n \t\t{pattern} bot wins {pattern}\n')
typing(f'\n{bot_win_exp}')
typing('\n rock-paper-scissors game developed by John Delvin from Solo learn\n \t beginners can try reading my code')
exit()