import random
print("Welcome to my Online Roulette game!")
print("Your starting balance is $50, or 5000 tokens.")
## Sets starting balance to 5000
balance=5000
## Function that should occur when a win takes place on green
def greenWin():
balance=balance+greenwin
print("The roll was a " + str(roll) +".")
print("Your balance is now "+ str(balance)+" tokens. Congratulations!")
## Function that should occur when a win takes place on red or black
def redBlackWin():
balance=balance+redblackwin
print("The roll was a " + str(roll) +".")
print("Your balance is now "+ str(balance)+" tokens. Congratulations!")
## Function that should occur when any bet is lost
def loss():
print("The roll was a " + str(roll) +".")
print("Your balance is now "+ str(balance)+" tokens.")
## Game goes on until balance is 0, then the for loop breaks
for i in range(999999999999):
## Asks user how many tokens should be bet
betamount=int(input("How many tokens would you like to bet?"))
## Asks user what color to bet on
betcolor=int(input("Bet on red (enter 1), black (enter 2), or green (enter 3)?"))
## Winning on a green bet is 35 times the amount of money bet
greenwin=betamount*35
## Winning on a red or black bet is 2 times the amount of money bet
redblackwin=betamount*2
## Rolls a random number from 0 to 36
roll=random.randint(0,36)
## Lists winning numbers for red and black
red=[1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36]
black=[2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35]
## Subtracts what you bet from your balance
balance=balance-betamount
## If you bet on red:
if betcolor is 1:
if roll is red:
redBlackWin()
else:
loss()
## If you bet on black:
elif betcolor is 2:
if roll is black:
redBlackWin()
else:
loss()
## If you bet on green:
elif betcolor is 3:
if roll is 0:
greenWin()
else:
loss()
## If your balance is 0 for loop breaks and game ends
if balance is 0:
print("You have ran out of money. Better luck next time!")
break