Advertisement
Guest User

roulette

a guest
Apr 18th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.72 KB | None | 0 0
  1. #Roulette, limited to only placing bets on Black/Red
  2. import random
  3. current_money = float(initial_bankroll)
  4. bet_amount = 0
  5. def main():
  6.     initial_bankroll = bankroll()
  7.     print("Your bankroll is", "$" + str(initial_bankroll))
  8.     game_mode = type_of_game()
  9.     print()
  10.     print()
  11.     if game_mode == "regular":
  12.         play_regular()
  13.     elif game_mode == "algorithm":
  14.         play_algorithm()
  15.     else:
  16.         print("Invalid game mode selection")
  17.         print()
  18.        
  19.     print("Current bankroll: $", str(current_money))
  20.    
  21.  
  22. def determine_winning(selection):
  23.    
  24.     random_number = random.randrange(1,39)
  25.     if selection == "red":
  26.         selection = random_number <= 17
  27.         if selection:
  28.             outcome = "You have won by landing on Red", str(random_number) + "/38)"
  29.              
  30.         elif selection == 38:
  31.             outcome = "You have lost by landing on the Green 0"
  32.            
  33.         else:
  34.             outcome = "You have lost by landing on Black", str(random_number) + "/38"
  35.            
  36.        
  37.         return outcome
  38.        
  39.     if selection == "black":
  40.         selection = 17<random_number<38
  41.         if selection:
  42.             outcome = "You have lost by landing on Red", str(random_number) + "/38)"
  43.            
  44.         elif selection == 38:
  45.             outcome = "You have lost by landing on the Green 0"
  46.            
  47.         else:
  48.             outcome = "You have won by landing on Black", str(random_number) + "/38"
  49.            
  50.        
  51.         return outcome
  52.  
  53. def current_bank_roll():
  54.     return current_money
  55.    
  56. def number_of_games_played():
  57.     pass
  58.    
  59.  
  60.    
  61. def play_regular():
  62.     print()
  63.     print("!" * len("Game mode is Regular"))
  64.     print("Game mode is Regular")
  65.     print("!" * len("Game mode is Regular"))
  66.     print()
  67.     print()
  68.     bet_amount = float(input("How much do you want to bet? :"))
  69.     print("You have bet: $" + str(bet_amount))
  70.     print()
  71.     color_picked = pick_a_color()
  72.     print()
  73.     print("!" * (len("You have selected: ") + len(color_picked)))
  74.     print("You have selected:", color_picked[0].upper() + color_picked[1:])
  75.     print("!" * (len("You have selected: ") + len(color_picked)))
  76.     print()
  77.     print("(Red are all numbers from 1 through and including 17)")
  78.     print("(Black are all numbers from 18 through and including 37)")
  79.     print("(The Green zero is the number 38)")
  80.     print()
  81.     print("!!!!!",determine_winning(color_picked),"!!!!!")
  82.     current_money = current_money - bet_amount
  83. def play_algorithm():
  84.     print("Game mode is Algorithm")
  85.    
  86. def pick_a_color():
  87.     option = input("Enter a color. (Enter Red or Black): ")
  88.     option = option.lower().strip()
  89.     return option
  90.    
  91. def change_color():
  92.     pass
  93.    
  94. def color_win_streak():
  95.     pass
  96.  
  97. def bankroll():
  98.     return float(input("Enter bankroll amount: "))
  99.    
  100. def type_of_game():
  101.     print()
  102.     option = input("Would you like to play a regular game of Roulette, or play using the color changing algorithm? (Enter Regular/Algorithm): ")
  103.     option = option.lower().strip()
  104.     return option
  105.    
  106. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement