[go: up one dir, main page]

0% found this document useful (0 votes)
21 views2 pages

Russian Roulette Simulator Python

The document describes a Russian Roulette simulator game where players aim to increase their money from $100 to $100,000 by taking turns firing a gun with a one in six chance of losing. Players can use a 'devmode' to avoid losing on their turn. The game ends when a player either reaches their goal or loses all their money, concluding with a realization that it was just a dream.

Uploaded by

2009571
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Russian Roulette Simulator Python

The document describes a Russian Roulette simulator game where players aim to increase their money from $100 to $100,000 by taking turns firing a gun with a one in six chance of losing. Players can use a 'devmode' to avoid losing on their turn. The game ends when a player either reaches their goal or loses all their money, concluding with a realization that it was just a dream.

Uploaded by

2009571
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

"""

LESSON: 2.5 - Randomness & Libraries


EXERCISE: Code Your Own

TITLE: [RUSSIAN ROULETTE SIMULATOR]


DESCRIPTION: [Play Russian Roulette till you either make a million, or lose it
all.]
"""
# NOTE TO REVIEWER
# TO SAVE A LOT OF TIME, ENTER 'devmode' WHEN PROMPTED TO SHOOT GUN.
# IT WILL MAKE IT SO YOU CAN'T LOSE TO THAT SHOT.

## IMPORTING ##
import random
import sys
## TITLE ##
new_game = input("|\ | | ____ ____ ----- /\ |\ | |\
/-----\ | | | |----- ------- ------- |-----" + "\n" +"| \ | | / /
| / \ | \ | | \ | | | | | | | |
|" + "\n" + "| | | | \ \ | / \ | \ | | | |
| | | | |_____ | | |_____" + "\n" + "| / | | \ \
| /------\ | \ | | / | | | | | | | |
|" + "\n" + "|\ \ / \ \ | / \ | \ | | \ |
| | | | | | | |" + "\n" + "| \ \_/ ___/ ____/
----- / \ | \| | \ \-----/ \____/ |_____ |----- | |
|----- " + "\n"+ "You start with $100, and your goal is to make it to
$100,000."+"\n"+"You can double your money by playing russian roulette, but if you
lose you lose everything." + "\n"*2 + "Press [ENTER] to play the game."+"\n") == ""
## MONEY AND ALIVENESS SETUP ##
money = 100
player_lives = True
## CHECKING ALL CONDITIONS NEEDED FOR PLAYING ##
while new_game and money < 100000 and player_lives:
print("You have $"+str(money))
chamber_filled = random.randint(1, 6)
input("You sit at the table, across from your enemy. "+"\n"+"Press [ENTER] to
flip a coin to see who goes first."+"\n") == "n"
flip = random.randint(1, 2)
if flip == 1:
p_turn = True
else:
p_turn = False
## OPPONENT ALIVENESS ##
opponent_lives = True
## GAME LOOP ##
while opponent_lives and player_lives:
if p_turn:
devmode = input("Your turn." +"\n"+ "Type anything to fire the gun. ")
== "devmode"
if devmode or chamber_filled > 1:
print("\n"+"You pull the trigger..."+"\n"+"...and the gun clicks.")
chamber_filled -= 1
elif chamber_filled <= 1:
print("/n"+"You pull the trigger... "+"\n"+"...and a party popper
goes off and kinda hurts your head."+"\n"+"YOU LOSE")
player_lives = False

else:
print("Opponent turn."+"\n"+"")
if chamber_filled <= 1:
print("\n"+"Your opponent pulls the trigger..."+"\n"+"...and a
party popper goes off from the gun!")
opponent_lives = False
else:
print("\n"+"Your opponent pulls the trigger... "+"\n"+"...and the
gun clicks.")
chamber_filled -= 1
p_turn = not p_turn
if player_lives:
money *= 2
print("/n"+"You end with $"+str(money)+"."+"\n"+"As everything ends, you realize
this was all just a dream and that the ACTUAL game is very different and school
appropriate.")
#if chamber_filled == 1:
# lose
#else:
# win
# chamber_filled -= 1

You might also like