-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrussian_roulette.py
39 lines (30 loc) · 1.1 KB
/
russian_roulette.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
# Russian Roulette game made in python. The rules are simple: Each player has to press enter to pull the trigger
# and the player that hits the chambers that contains the bullet, losses!
# After the game is over the user has the option to restart the game.
import random
import os
import sys
from playsound import playsound
print(""" || RUSSIAN ROULETTE GAME ||
________.
~(_]-------'
/_(U
""")
chambers = input("Please enter the number of chambers (default = 6): ")
if not chambers:
chambers = 5
elif not chambers.isdigit():
quit("Invalid number of chambers!")
fatal_bullet = random.randint(1, int(chambers))
for x in range(1, int(chambers) + 1):
input("Press enter to pull the trigger! ")
if x == fatal_bullet:
playsound('gun-firing17.wav')
print("Game Over")
print("YOU DIED!!!")
start_again = input("Do you want to start again? (y/n): ")
if start_again and start_again.lower()[0] == "y":
os.execv(sys.executable, [sys.executable] + sys.argv)
else:
break
print("You will live to see the dawn")