This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
593 lines (563 loc) · 21.3 KB
/
main.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
import os
import random
import re
from colorama import Fore
def disk_adjustsize(size):
factor = 1024
for i in ["B", "KB", "MB", "GB", "TB", "PB"]:
if size > factor:
size = size / factor
else:
return f"{size:.3f}{i}"
def get_coins():
settings_file = open("settings.txt", "r+")
coins = settings_file.readlines()[0]
coins = int(re.split(":", coins)[1])
if coins <= 0:
coins = 0
return int(coins)
def get_version():
settings_file = open("settings.txt", "r+")
version = settings_file.readlines()[1]
version = str(re.split(":", version)[1])
return version
def clear_console():
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
def update_coins(coins):
settings_file = open("settings.txt", "r+").readlines()
os.remove("settings.txt")
f = open('settings.txt', 'a')
data = settings_file
data[0] = f"money:{coins}\n"
f.writelines(data)
def settings(coins):
print(Fore.RESET)
clear_console()
print(Fore.BLUE)
try:
setting = int(input("Please select a setting: [0] Back | [1] Give Coins | [2] Remove Coins | [3] Info/Bugs:"))
except Exception:
print(Fore.RED)
print("Please enter a valid number")
settings()
if setting == 1:
try:
coins_to_give = int(input("How much Coins do you want to cheat? Please enter the amount:"))
except Exception:
print(Fore.RED)
print("Please enter a number")
settings(coins)
coins = coins + coins_to_give
update_coins(coins)
elif setting == 2:
try:
coins_to_clear = int(input("How much Coins do you want to remove? Please enter the amount:"))
except Exception:
print(Fore.RED)
print("Please enter a number")
settings(coins)
coins = coins - coins_to_clear
update_coins(coins)
elif setting == 3:
print(
f"{Fore.LIGHTBLUE_EX}Mini Games is a collection od classic mini and casino games with it's own money system.\n"
f"If you want to create a bug/issue report at https://github.com/HumanBot000/MiniGames/issues please copy the text below."
f"This makes it a lot easier to debug:"
f"{Fore.RED}\n")
print(f"{Fore.RED}version:{get_version()}{Fore.RESET}")
input()
print(Fore.RESET)
elif setting == 0:
main()
print(Fore.RESET)
settings(coins)
def validate_int(number):
try:
number = int(number)
except Exception:
return False
else:
if number >= 0:
return number
else:
return False
def game_guess_the_number():
clear_console()
print(Fore.RESET)
print(Fore.CYAN)
try:
game = int(input("Please select a Task: [0] Rules | [1] Play | [2] Back:"))
except Exception:
print(Fore.RED)
print("Please enter a valid number")
game_guess_the_number()
if game == 1:
coins = get_coins()
print(Fore.YELLOW)
try:
bet = int(input("How much do you bet?:"))
if coins < bet:
print(Fore.RED)
print(f"You only have {coins} coins")
print(Fore.RESET)
game_guess_the_number()
if coins < 0:
game_guess_the_number()
except Exception:
print(Fore.RED)
print("Please enter a valid number")
game_guess_the_number()
try:
print(Fore.BLUE)
mode = int(input("Which range do you choose? [0] 0-10 (5x) | [1] 0-100(x50) | [2] 0-1000(x750):"))
print(Fore.RESET)
except Exception:
print(Fore.RED)
print("Please enter a valid number")
game_guess_the_number()
coins = coins - bet
if mode == 0:
clear_console()
print(Fore.CYAN)
while True:
try:
print(Fore.CYAN)
number_user = int(input("Please enter a number between 0 and 10:"))
if not number_user <= 10:
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
else:
break
except Exception:
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
number_bot = random.randint(0, 10)
if number_user == number_bot:
print(Fore.GREEN)
print("You Won your coins will be multiply by x5")
print(Fore.RESET)
coins_to_give = bet * 5
coins = coins + coins_to_give
update_coins(coins)
input()
game_guess_the_number()
else:
print(Fore.RED)
print(f"You lose the bot had {number_bot} all your coins are gone")
print(Fore.RESET)
update_coins(coins)
input()
game_guess_the_number()
elif mode == 1:
clear_console()
print(Fore.CYAN)
while True:
try:
print(Fore.CYAN)
number_user = int(input("Please enter a number between 0 and 100:"))
if not number_user <= 100:
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
else:
break
except Exception:
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
number_bot = random.randint(0, 100)
if number_user == number_bot:
print(Fore.GREEN)
print("You Won your coins will be multiply by x50")
print(Fore.RESET)
coins_to_give = bet * 50
coins = coins + coins_to_give
update_coins(coins)
input()
game_guess_the_number()
else:
print(Fore.RED)
print(f"You lose the bot had {number_bot} all your coins are gone")
print(Fore.RESET)
update_coins(coins)
input()
game_guess_the_number()
elif mode == 2:
clear_console()
print(Fore.CYAN)
while True:
try:
print(Fore.CYAN)
number_user = int(input("Please enter a number between 0 and 1000:"))
if not number_user <= 1000:
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
else:
break
except Exception:
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
number_bot = random.randint(0, 1000)
if number_user == number_bot:
print(Fore.GREEN)
print("You Won your coins will be multiply by x750")
print(Fore.RESET)
coins_to_give = bet * 750
coins = coins + coins_to_give
update_coins(coins)
input()
game_guess_the_number()
else:
print(Fore.RED)
print(f"You lose the bot had {number_bot} all your coins are gone")
print(Fore.RESET)
update_coins(coins)
input()
game_guess_the_number()
else:
game_guess_the_number()
if game == 0:
print(Fore.GREEN)
print(
"Inputs: \n bet: [a number between 0 and your coins] the bet you like to set \n range[1-3] \n guess[0-range] your guess \n"
"First you set your coins to bet\n"
"After that you decide for a range than higher the range is, than higher is also the multiplier\n"
"Then you have to choose a number.Your goal is to have the same number like the bot.")
input()
print(Fore.RESET)
game_black_jack()
if game == 2:
get_game()
def game_black_jack():
clear_console()
print(Fore.RESET)
print(Fore.CYAN)
try:
game = int(input("Please select a Task: [0] Rules | [1] Play | [2] Back:"))
except Exception:
print(Fore.RED)
print("Please enter a valid number")
game_black_jack()
if game == 1:
coins = get_coins()
print(Fore.YELLOW)
try:
bet = int(input("How much do you bet?:"))
if coins < bet:
print(Fore.RED)
print(f"You only have {coins} coins")
print(Fore.RESET)
game_black_jack()
input()
if bet < 0:
print("please enter a valid number")
input()
game_black_jack()
except Exception:
print(Fore.RED)
print("Please enter a valid number")
game_black_jack()
coins = coins - bet
own_amount = 0
while True:
print(Fore.MAGENTA)
try:
option = int(input(
f"The Maximum is 20,you have{Fore.RED} {own_amount} {Fore.MAGENTA}what do you like to do? [0] Reveal Dealers Score | [1] Raise Score:"))
except Exception:
print(Fore.RED)
print("Please enter a valid number")
else:
if option == 0:
dealer_amount = 19
while True:
probability = random.randint(1, 100)
if probability <= 70 and probability > 0: # 70 %
dealer_amount = dealer_amount - 1
else:
break
if own_amount == dealer_amount:
print(Fore.YELLOW)
print("Its a draw you get your coins back")
print(Fore.RESET)
coins = coins + bet
update_coins(coins)
input()
game_black_jack()
elif own_amount > dealer_amount:
print(Fore.GREEN)
print(f"You won the dealer had {dealer_amount} points your coins will be multiply by 2x")
print(f"now you have {coins + bet + bet} coins")
print(Fore.RESET)
coins = coins + bet + bet
update_coins(coins)
input()
game_black_jack()
elif own_amount < dealer_amount:
print(Fore.RED)
print(f"You loosed the dealer had {dealer_amount} points your coins are gone")
print(Fore.RESET)
update_coins(coins)
input()
game_black_jack()
if option == 1:
own_amount = own_amount + random.randint(1, 5)
if own_amount > 20:
print(Fore.RED)
print(f"You Lose your score is now {own_amount} your points are gone")
print(Fore.RESET)
update_coins(coins)
input()
game_black_jack()
if game == 0:
print(Fore.GREEN)
print("Inputs: \n bet: [a number between 0 and your coins] the bet you like to set \n action:[0,1]\n "
"The Game: after you set your bet you have to decide if you raise your score or compare to dealer. \n "
"If you raise the score it will be raised by a random number between 1 and 5.\n"
"The goal is to reach the highest score.But be carefully if your score gets over 20 the game will end any you loes your coins.\n"
"If you compare to the dealer the dealer starts at 19 and with a probability of 70% it will go one lower.\n"
"Coins: You lose = bet is gone\n"
"Draw = get your bet back\n"
"Win = multiple by 2 ")
input()
print(Fore.RESET)
game_black_jack()
if game == 2:
get_game()
def game_jackpot():
clear_console()
print(Fore.CYAN)
coins = get_coins()
coins_start = coins
task = str(input("Please select a Task: [0] Rules | [1] Play | [2] Back:"))
if validate_int(task) == False and task != "0":
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
game_jackpot()
else:
if validate_int(task) >= 0 and validate_int(task) <= 2:
task = int(task)
if task == 0:
print(Fore.GREEN)
print(f"Inputs: \n bet: [a number between 0 and your coins] the bet you like to set \n action:[0,1]\n"
f"The Game:you have a multiplier at the beginning its by x0 than you decide if you want to raise it \n"
f"or end the game if you raise it you have a 40% chance to double the multiplier 0 -> 2 -> 4 -> ...\n"
f"If you are unlucky all your coins are away\n"
f"Note if you end with a x0 multiplier your coins are also gone")
input()
game_jackpot()
print(Fore.RESET)
elif task == 1:
print(Fore.YELLOW)
bet = validate_int(input(f"How much do you bet?:"))
print(Fore.RESET)
if bet == False:
game_jackpot()
else:
if bet <= coins:
coins = coins - bet
multiplier = 0
while True:
task = validate_int(
input(f"{Fore.MAGENTA}The multiplier is now {Fore.RED}x{multiplier}{Fore.MAGENTA}\n"
f"What do you do? [0] End Game | [1] Raise Multiplier:{Fore.RESET}"))
if task == 0:
coins_tg = bet * multiplier
coins = coins + coins_tg
update_coins(coins)
print(
f"{Fore.GREEN}You ended with x{multiplier}{Fore.RESET}")
input()
game_jackpot()
if task == 1:
if random.randint(1, 10) <= 4: # 40%
if multiplier == 0:
multiplier = 2
else:
multiplier = multiplier * 2
else:
update_coins(coins)
print(
f"{Fore.RED}You lost all your coins are gone{Fore.RESET}")
input()
game_jackpot()
else:
print(f"{Fore.RED}You only have {coins} coins {Fore.RESET}")
input()
game_jackpot()
elif task == 2:
get_game()
else:
print(Fore.RED)
print("Please enter a valid number")
print(Fore.RESET)
game_jackpot()
print(Fore.RESET)
def game_psr():
clear_console()
print(Fore.CYAN)
coins = get_coins()
while True:
try:
print(Fore.CYAN)
task = int(input("Please select a Task: [0] Rules | [1] Play | [2] Back:"))
except Exception:
print(f"{Fore.RED}Please enter a valid number{Fore.RESET}")
else:
break
if task == 2:
get_game()
elif task == 0:
print(Fore.GREEN)
print("Inputs: \n bet: [a number between 0 and your coins] the bet you like to set \n action:[1,2,3]\n"
"The Game: \nYou don´t know the game?It´s iconic just google it.\nThe multiplier is 2x")
print(Fore.RESET)
input()
game_psr()
elif task == 1:
while True:
try:
print(Fore.YELLOW)
bet_coins = int(input("How much do you bet?:"))
except Exception:
print(f"{Fore.RED}Please enter a valid number{Fore.RESET}")
else:
if bet_coins <= int(get_coins()) and bet_coins >= 0:
break
else:
print(f"{Fore.RED}You don´t have enough coins")
while True:
try:
print(Fore.CYAN)
p_choice = int(input("What do you choose: [1] Paper | [2] Scissors | [3] Rock:"))
except Exception:
print(f"{Fore.RED}Please enter a valid number{Fore.RESET}")
else:
break
b_choice = random.randint(1, 3)
if p_choice == 1:
if b_choice == 1:
print(Fore.YELLOW)
print("Its a draw you get your coins back")
print(Fore.RESET)
input()
game_psr()
elif b_choice == 2:
print(Fore.RED)
print(f"You loosed the bot chose {b_choice} your coins are gone")
print(Fore.RESET)
coins_tg = coins - bet_coins
update_coins(coins_tg)
input()
game_psr()
elif b_choice == 3:
print(Fore.GREEN)
print(f"You won the bot chose {b_choice}")
print(Fore.RESET)
coins_tg = coins + bet_coins
update_coins(coins_tg)
input()
game_psr()
elif p_choice == 2:
if b_choice == 2:
print(Fore.YELLOW)
print("Its a draw you get your coins back")
print(Fore.RESET)
input()
game_psr()
elif b_choice == 3:
print(Fore.RED)
print(f"You loosed the bot chose {b_choice} your coins are gone")
print(Fore.RESET)
coins_tg = coins - bet_coins
update_coins(coins_tg)
input()
game_psr()
elif b_choice == 1:
print(Fore.GREEN)
print(f"You won the bot chose {b_choice}")
print(Fore.RESET)
coins_tg = coins + bet_coins
update_coins(coins_tg)
input()
game_psr()
elif p_choice == 3:
if b_choice == 3:
print(Fore.YELLOW)
print("Its a draw you get your coins back")
print(Fore.RESET)
input()
game_psr()
elif b_choice == 1:
print(Fore.RED)
print(f"You loosed the bot chose {b_choice} your coins are gone")
print(Fore.RESET)
coins_tg = coins - bet_coins
update_coins(coins_tg)
input()
game_psr()
elif b_choice == 2:
print(Fore.GREEN)
print(f"You won the bot chose {b_choice}")
print(Fore.RESET)
coins_tg = coins + bet_coins
update_coins(coins_tg)
input()
game_psr()
def get_game():
clear_console()
print(Fore.RESET)
print(Fore.CYAN)
try:
game = int(
input(
"Please select a game: [0] Back | [1] Guess the Number | [2] Black Jack | [3] Jackpot Game [4] Paper-Scissors-Rock:"))
except Exception:
print(Fore.RED)
print("Please enter a valid number")
get_game()
if game == 1:
game_guess_the_number()
elif game == 2:
game_black_jack()
elif game == 3:
game_jackpot()
elif game == 4:
game_psr()
elif game == 0:
main()
def main():
coins = get_coins()
print(Fore.RESET)
print(Fore.RED)
print(f"You have {coins} coins.")
print(Fore.GREEN)
try:
game = int(input("Please select a task: [0] Help | [1] Settings | [2] Games:"))
except Exception:
print(Fore.RED)
print("Please enter a valid number")
game = 0
print(Fore.RESET)
if game == 0:
clear_console()
print(Fore.GREEN)
print("""Actions: You have to enter the number in the brackets([ and ]) before the Action this is how to navigate through menus
Economy:You have an specific balance on your bank you will see it at the main screen.If you win in games you will multiple your money.If you haven´t enough money you can cheat some in the settings
""")
main()
if game == 1:
settings(coins)
if game == 2:
get_game()
else:
main()
main()