[Mathematics] H@x0r1ng the Betting System 10-27-2015, 06:58 AM
#1
A while back, @"Lux" taught me a betting strategy that supposedly guaranteed big wins. I decided at the time to simulate it a million times in python and look at my winnings. What I found was surprising.
The technique is as follows: You have a starting amount, and your starting bet. Your starting bet is usually the square root of or just 10% of your starting money. You place a bet. If you lose, your bet amount doubles, and if you win, your betting amount is reset to the original.
This consistently showed a massive profit and basically proved that @"Lux"'s method was legit. Or did it? Let's try with a smaller scale and verbose output.
Running that, placing 100 bets, gives us an interesting set of results. Here's a snippet:
What happened on those lines is that the computer lost the previous bet and went into negatives. This basically means that the computer cannot make the next bet as it does not have the necessary balance in order to do so. But the bet amount was still as normal doubling, so it was inevitable that it'd win and get back into positive balance. Basically, it "borrowed" money in order to place bets when it didn't have enough. We can take away the total borrowed from the end balance at the end to get the profit.
This seemed to work:
Except when it didn't:
Now, if we didn't factor in the borrowing, that would have shown up as a profit as the end balance was 280. The negative impact of the borrowing can be properly appreciated with more bets. Here's a set of results at a million bets. Note that although the balance is massive, the computer borrowed a fuck tonne of money each time, and so overall lost money.
Of course, in the betting system that we have here at SL, we can't really feasibly borrow that much money. So let's add validation to check if the current_bet is more than the balance, or if the balance is less than 0, and to stop betting in both instances.
Sometimes stuff like this happened:
Where the computer went bankrupt very quickly. Sometimes it took a while:
And sometimes it managed to fully complete the betting cycle and come out on top:
Happy betting.
Oh, and @"Lux" may have some improvements on the strategy above that could be implemented to shift the odds in the player's favour, so look out for part two of this thread. I'll also be making a little script that you use based on the above strategy to make it more likely to come out on top.
The technique is as follows: You have a starting amount, and your starting bet. Your starting bet is usually the square root of or just 10% of your starting money. You place a bet. If you lose, your bet amount doubles, and if you win, your betting amount is reset to the original.
Code:
from random import randint
def placeBet():
return randint(0, 1)
balance = 100
starting_bet = balance / 10
current_bet = starting_bet
for x in range(1000000): #1000000 bets
stat = placeBet()
if stat == 0: #lose
balance -= current_bet
current_bet += current_bet
if stat == 1: #win
balance += current_bet
current_bet = starting_bet
print balance
This consistently showed a massive profit and basically proved that @"Lux"'s method was legit. Or did it? Let's try with a smaller scale and verbose output.
Code:
from random import randint
def placeBet():
return randint(0, 1)
balance = 100
starting_bet = balance / 10
current_bet = starting_bet
for x in range(100): #100 bets
stat = placeBet()
if stat == 0: #lose
balance -= current_bet
current_bet += current_bet
print "Lost! New Balance: %s New Betting Amount: %s" % (str(balance), str(current_bet))
if stat == 1: #win
balance += current_bet
current_bet = starting_bet
print "Won! New Balance: %s New Betting Amount: %s" % (str(balance), str(current_bet))
Running that, placing 100 bets, gives us an interesting set of results. Here's a snippet:
Quote:Won! New Balance: 110 New Betting Amount: 10
Won! New Balance: 120 New Betting Amount: 10
Lost! New Balance: 110 New Betting Amount: 20
Lost! New Balance: 90 New Betting Amount: 40
Lost! New Balance: 50 New Betting Amount: 80
Lost! New Balance: -30 New Betting Amount: 160
Lost! New Balance: -190 New Betting Amount: 320
Lost! New Balance: -510 New Betting Amount: 640
Won! New Balance: 130 New Betting Amount: 10
Won! New Balance: 140 New Betting Amount: 10
Won! New Balance: 150 New Betting Amount: 10
What happened on those lines is that the computer lost the previous bet and went into negatives. This basically means that the computer cannot make the next bet as it does not have the necessary balance in order to do so. But the bet amount was still as normal doubling, so it was inevitable that it'd win and get back into positive balance. Basically, it "borrowed" money in order to place bets when it didn't have enough. We can take away the total borrowed from the end balance at the end to get the profit.
Code:
from random import randint
def placeBet():
return randint(0, 1)
balance = 100
starting_bet = balance / 10
current_bet = starting_bet
owed = 0
for x in range(50): #50 bets
stat = placeBet()
if stat == 0: #lose
balance -= current_bet
current_bet += current_bet
print "Lost! New Balance: %s New Betting Amount: %s" % (str(balance), str(current_bet))
if stat == 1: #win
balance += current_bet
current_bet = starting_bet
print "Won! New Balance: %s New Betting Amount: %s" % (str(balance), str(current_bet))
if current_bet > balance:
owed += current_bet - balance
print "Owed: %s" % str(owed)
print "Profit: %s" % str(balance - owed)
This seemed to work:
Quote:Owed: 250
Profit: 140
Except when it didn't:
Quote:Owed: 1650
Profit: -1370
Now, if we didn't factor in the borrowing, that would have shown up as a profit as the end balance was 280. The negative impact of the borrowing can be properly appreciated with more bets. Here's a set of results at a million bets. Note that although the balance is massive, the computer borrowed a fuck tonne of money each time, and so overall lost money.
Quote:Balance: 5000950
Owed: 78008950
Profit: -73008000
Balance: 5000610
Owed: 176100380
Profit: -171099770
Balance: 4994280
Owed: 89699620
Profit: -84705340
Of course, in the betting system that we have here at SL, we can't really feasibly borrow that much money. So let's add validation to check if the current_bet is more than the balance, or if the balance is less than 0, and to stop betting in both instances.
Code:
from random import randint
def placeBet():
return randint(0, 1)
balance = 100
starting_bet = balance / 10
current_bet = starting_bet
for x in range(50): #50 bets
stat = placeBet()
if stat == 0: #lose
balance -= current_bet
current_bet += current_bet
print "Lost! New Balance: %s New Betting Amount: %s" % (str(balance), str(current_bet))
if stat == 1: #win
balance += current_bet
current_bet = starting_bet
print "Won! New Balance: %s New Betting Amount: %s" % (str(balance), str(current_bet))
if current_bet > balance or balance < 0:
print "Failed! You're bankrupt. Balance: %s" % str(balance)
break
Sometimes stuff like this happened:
Quote:Won! New Balance: 110 New Betting Amount: 10
Lost! New Balance: 100 New Betting Amount: 20
Lost! New Balance: 80 New Betting Amount: 40
Lost! New Balance: 40 New Betting Amount: 80
Failed! You're bankrupt. Balance: 40
Where the computer went bankrupt very quickly. Sometimes it took a while:
Quote:Won! New Balance: 110 New Betting Amount: 10
Won! New Balance: 120 New Betting Amount: 10
Won! New Balance: 130 New Betting Amount: 10
Won! New Balance: 140 New Betting Amount: 10
Won! New Balance: 150 New Betting Amount: 10
Won! New Balance: 160 New Betting Amount: 10
Lost! New Balance: 150 New Betting Amount: 20
Won! New Balance: 170 New Betting Amount: 10
Won! New Balance: 180 New Betting Amount: 10
Won! New Balance: 190 New Betting Amount: 10
Lost! New Balance: 180 New Betting Amount: 20
Won! New Balance: 200 New Betting Amount: 10
Won! New Balance: 210 New Betting Amount: 10
Won! New Balance: 220 New Betting Amount: 10
Won! New Balance: 230 New Betting Amount: 10
Lost! New Balance: 220 New Betting Amount: 20
Lost! New Balance: 200 New Betting Amount: 40
Lost! New Balance: 160 New Betting Amount: 80
Lost! New Balance: 80 New Betting Amount: 160
Failed! You're bankrupt. Balance: 80
And sometimes it managed to fully complete the betting cycle and come out on top:
Quote:Won! New Balance: 110 New Betting Amount: 10
Lost! New Balance: 100 New Betting Amount: 20
Won! New Balance: 120 New Betting Amount: 10
Won! New Balance: 130 New Betting Amount: 10
Lost! New Balance: 120 New Betting Amount: 20
Won! New Balance: 140 New Betting Amount: 10
Lost! New Balance: 130 New Betting Amount: 20
Lost! New Balance: 110 New Betting Amount: 40
Won! New Balance: 150 New Betting Amount: 10
Won! New Balance: 160 New Betting Amount: 10
Lost! New Balance: 150 New Betting Amount: 20
Lost! New Balance: 130 New Betting Amount: 40
Won! New Balance: 170 New Betting Amount: 10
Lost! New Balance: 160 New Betting Amount: 20
Lost! New Balance: 140 New Betting Amount: 40
Lost! New Balance: 100 New Betting Amount: 80
Won! New Balance: 180 New Betting Amount: 10
Won! New Balance: 190 New Betting Amount: 10
Lost! New Balance: 180 New Betting Amount: 20
Lost! New Balance: 160 New Betting Amount: 40
Won! New Balance: 200 New Betting Amount: 10
Won! New Balance: 210 New Betting Amount: 10
Lost! New Balance: 200 New Betting Amount: 20
Won! New Balance: 220 New Betting Amount: 10
Lost! New Balance: 210 New Betting Amount: 20
Lost! New Balance: 190 New Betting Amount: 40
Won! New Balance: 230 New Betting Amount: 10
Lost! New Balance: 220 New Betting Amount: 20
Lost! New Balance: 200 New Betting Amount: 40
Won! New Balance: 240 New Betting Amount: 10
Lost! New Balance: 230 New Betting Amount: 20
Lost! New Balance: 210 New Betting Amount: 40
Lost! New Balance: 170 New Betting Amount: 80
Won! New Balance: 250 New Betting Amount: 10
Won! New Balance: 260 New Betting Amount: 10
Lost! New Balance: 250 New Betting Amount: 20
Won! New Balance: 270 New Betting Amount: 10
Lost! New Balance: 260 New Betting Amount: 20
Won! New Balance: 280 New Betting Amount: 10
Lost! New Balance: 270 New Betting Amount: 20
Lost! New Balance: 250 New Betting Amount: 40
Lost! New Balance: 210 New Betting Amount: 80
Won! New Balance: 290 New Betting Amount: 10
Won! New Balance: 300 New Betting Amount: 10
Won! New Balance: 310 New Betting Amount: 10
Lost! New Balance: 300 New Betting Amount: 20
Lost! New Balance: 280 New Betting Amount: 40
Won! New Balance: 320 New Betting Amount: 10
Won! New Balance: 330 New Betting Amount: 10
Won! New Balance: 340 New Betting Amount: 10
Happy betting.
Oh, and @"Lux" may have some improvements on the strategy above that could be implemented to shift the odds in the player's favour, so look out for part two of this thread. I'll also be making a little script that you use based on the above strategy to make it more likely to come out on top.