Skip to content

Instantly share code, notes, and snippets.

Created February 14, 2015 18:15
Show Gist options
  • Save anonymous/d4a583bffd768be99e9b to your computer and use it in GitHub Desktop.
Save anonymous/d4a583bffd768be99e9b to your computer and use it in GitHub Desktop.
import random
bank = raw_input("Enter your Deposit: $")
fbank = float(bank)
while fbank > 0:
print "Your bank is now: $" + str(fbank)
#Amount player is wagering
bet = raw_input("How much would you like to bet?: $")
fbet = float(bet)
#Your 3 Dice Roll
x = random.randint(1,6)
y = random.randint(1,6)
z = random.randint(1,6)
print "This is your Roll:", x, y, z
#Rolling a 4 5 6 is an automatic win, the computer does not even roll if you roll this
if (x == 4 and y == 5 and z == 6) or (x == 4 and y == 6 and z == 5) or (x == 5 and y == 4 and z == 6) or (x == 5 and y == 6 and z == 4) or (x == 6 and y == 5 and z == 4) or (x == 6 and y == 4 and z == 5):
player_roll = 100
print "You rolled a 4 5 6, YOU WIN!!!!!"
#Opposite of rolling a 4 5 6, rolling a 1 2 3 is an automatic loss, the computer does not roll
elif (x == 1 and y == 2 and z == 3) or (x == 1 and y == 3 and z == 2) or (x == 2 and y == 1 and z == 3) or (x == 2 and y == 3 and z == 1) or (x == 3 and y == 1 and z == 2) or (x == 3 and y == 2 and z == 1):
player_roll = -100
print "You rolled a 1 2 3, You LOSE!!!!!"
#Rolling three of a kind beats rolling any one integer, but three 6s beats three 5s
elif x == y and y == z and x == z:
player_roll = (x * 11)
print "Your rolled Trip", str(x) + "s!!!"
#The following 3 elif statements calculate the same thing. When two integers match, the unmatched integer is the score
elif x == y and y != z:
player_roll = z
print "You rolled a", str(z)
elif x == z and z != y:
player_roll = y
print "You rolled a", str(y)
elif y == z and z != x:
player_roll = x
print "You rolled a", str(x)
#If none of the integers match, there is no score, reroll
else:
player_roll = 0
print "Roll Again"
#The following occurs when the player rolled a 1 2 3 and automatically loses
if player_roll = -100:
fbank = fbank - fbet
#The following occurs when the player rolled a 4 5 6 and automatically wins
elif player_roll = 100:
fbank = fbank + fbet
#The following occurs when
elif player_roll >= 1 and <= 66:
#Computer 3 Dice Roll
a = random.randint(1,6)
b = random.randint(1,6)
c = random.randint(1,6)
print "This is the computer's roll:", a, b, c
if (a == 4 and b == 5 and c == 6) or (a == 4 and b == 6 and c == 5) or (a == 5 and b == 4 and c == 6) or (a == 5 and b ==6 and c == 4) or (a == 6 and b == 5 and c == 4) or (a == 6 and b == 4 and c == 5):
print "The Computer rolled a 4 5 6, YOU LOSE!!!!!"
fbank = fbank - fbet
elif (x == 1 and y == 2 and z == 3) or (x == 1 and y == 3 and z == 2) or (x == 2 and y == 1 and z == 3) or (x == 2 and y == 3 and z == 1) or (x == 3 and y == 1 and z == 2) or (x == 3 and y == 2 and z == 1):
print "The Computer rolled a 1 2 3, You WIN!!!!!"
elif a == b and b == c and a == c:
computer_roll = (a * 11)
print "Your rolled Trip", str(a) + "s!!!"
elif a == b and b != c:
computer_roll = c
print "You rolled a", str(c)
elif a == c and c != b:
computer_roll = b
print "You rolled a", str(b)
elif y == z and z != x:
computer_roll = a
print "You rolled a", str(a)
else:
computer_roll = 0
print "Roll Again"
if player_roll > computer_roll:
fbank = fbank + fbet
print "You win!"
print "Your bank is now", str(fbank)
elif: player_roll < computer_roll:
fbank = fbank - fbet
print "You lose!"
print "Your bank is now", str(fbank)
else:
print "You push, Re-roll"
else:
print "You have no money in your bank, make a deposit to play"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment