Why is this code faster with Python than with C++?
A Terraria Review: Is it Good?

How To Make A Slot Machine Game In Python

So, I am currently working on a project called Henry's Palace (after Caesars Palace in Las Vegas) on Python. What was a simple dice game to teach m how to code probability has ballooned into 800 lines of code. recently, I added a huge extension, the slot machine. As I had trouble doing this I will show you my personal code for copy and pasting. You'll have to add spaces yourself. 

sym1 = random.choice(symbols)
sym2 = random.choice(symbols)
sym3 = random.choice(symbols)
print("---Symbols---")
print(sym1, sym2, sym3, "\n")
if (sym1 == sym2 or sym1 == sym3 or sym2 == sym3) and not(sym1 == sym2 == sym3):
print("Winner! +5p")
credit += 45
return credit

elif (sym1 == sym2 == sym3) and sym1 != "Bell":
print("Winner! +£50")
credit = credit + 50
return credit

elif (sym1 == sym2 == sym3) and (sym1 == "Bell"):
print("Jackpot! +£15")
credit = credit + 50
return credit

elif (sym1 == sym2 == "Skull" or sym1 == sym3 == "Skull" or sym2 == sym3 == "Skull") and not(sym1 == sym2 == sym3):
print("Two Skulls! -£75")
credit = credit - 100
return credit

elif (sym1 == sym2 == sym3) and sym1 == "Skull":
print("Three Skulls! Lose all credit")
credit = 0
return credit

else:
print("Loser! -£20")
credit = - 20
return credit

symbols = ["Cherry", "Bell", "Lemon", "Orange", "Star", "Skull"]
print("You have", credit, "p", "\n")

#moneydrinker function
def moneydrinker(credit):
while True:
print("")
play = input("Roll costs 10p. Would you like to roll? yes/no: ")
print("")
if play == "yes" or "y" or "Yes" or "Y":
if credit >= 20:
credit=roll(credit)
credit -= 10
print("Credit is", credit, "p")
if credit < 20:
print ("You need more points! Time to go home,right?")
else:
print("You do not enough money to roll!")
if intro==1:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)