Created
July 4, 2016 01:25
-
-
Save Riketta/5c5422969a142ee33a6798ba3ff0519e to your computer and use it in GitHub Desktop.
Simple Casino randomizator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Casino rules: u bet & roll - if result (>= 0 and <= 45) - u get 1X, if (r == 65) get 3X, if (r == 100) - 4X! | |
import random | |
stdbalance = 15000 | |
balance = stdbalance | |
avgbalance = 0 | |
bet = 1000 | |
iterations = 15 | |
for z in range(1, iterations): | |
balance = stdbalance | |
for i in range(1, 45): | |
r = random.randint(0, 100) | |
if r <= 40: | |
balance -= bet | |
elif r == 65: | |
balance -= 3 * bet | |
elif r == 100: | |
balance -= 4 * bet | |
else: | |
balance += bet | |
avgbalance += balance | |
print(balance, " - ", str(int(balance / stdbalance * 100)) + "%" + (" - Less!" if balance < stdbalance else "")) | |
avgbalance /= iterations | |
print("Average: ", int(avgbalance), "-", str(int(avgbalance / stdbalance * 100)) + "%") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment