I've written a whale simulation program and have run some trials with it (it is only a quick and dirty perl script and I am not a great programmer but it seems to work).
Look at the comments in the code to see what it does. Basically a whale takes on the bank, betting max until one or the other goes broke.
It takes the following parameters:
- number of trials
- whale's bankroll
- house's bankroll
- maximum bet (as a % of the house's roll
house edge (this is expressed as a number between 0 and 199, 100 represents a 1% house edge, 101 would be a 2% edge, etc)
It reports results like this:
bash-3.2$ ./whale_sim.pl 10 25000 25000 0.01 100
roll_num => 5294, bet => 387.43, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 18335.95, jw => 2695, ww => 2599
roll_num => 10742, bet => 3.18, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 14505.12, jw => 5433, ww => 5309
roll_num => 571, bet => 81.16, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 24007.70, jw => 322, ww => 249
roll_num => 4960, bet => 102.77, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 23369.29, jw => 2527, ww => 2433
roll_num => 2166, bet => 409.23, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 20695.56, jw => 1122, ww => 1044
roll_num => 29386, bet => 234.59, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 4441.13, jw => 14801, ww => 14585
roll_num => 8725, bet => 119.31, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 18439.80, jw => 4419, ww => 4306
roll_num => 14902, bet => 407.67, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 7332.98, jw => 7523, ww => 7379
roll_num => 21831, bet => 231.58, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 4008.85, jw => 11005, ww => 10826
roll_num => 619, bet => 200.83, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 24242.92, jw => 346, ww => 273
The legend is:
roll_num - the roll number when the simulation ended
bet - the bet size
jd_bal - Just-Dice's ending balance
whale_bal - Whale's ending balance
max - Just-Dice's highest balance during the simulation
min - Just-Dice's lowest balance during the simulation
jw - winning rolls for J-D
ww - winning rolls for the whale
I've done a lot of runs, and can summarize as follows:
- the house always wins in the end
- volatility is a bitch (when I gave the whale 4x the balance of the house the house was down 80% a few times, but always won eventually)
bash-3.2$ ./whale_sim.pl 10 100000 25000 0.01 100
roll_num => 15429, bet => 759.48, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 20707.98, jw => 7832, ww => 7597
roll_num => 9460, bet => 572.40, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 21912.81, jw => 4834, ww => 4626
roll_num => 18783, bet => 364.74, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 13347.83, jw => 9519, ww => 9264
roll_num => 29059, bet => 288.24, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 8580.01, jw => 14683, ww => 14376
roll_num => 8500, bet => 541.51, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 24750.00, jw => 4352, ww => 4148
roll_num => 13605, bet => 984.95, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 18119.94, jw => 6917, ww => 6688
roll_num => 4898, bet => 528.69, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 19163.66, jw => 2542, ww => 2356
roll_num => 17691, bet => 960.43, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 10519.66, jw => 8970, ww => 8721
roll_num => 17107, bet => 585.96, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 21547.66, jw => 8677, ww => 8430
roll_num => 32050, bet => 232.41, jd_bal => 125000.00, whale_bal => 0.00, max => 125000.00, min => 10047.04, jw => 16186, ww => 15864
See, with a 100,000
BTC starting bankroll for the whale the house gets down to 8580 in trial 4. I've seen lower.
One last sim before my bedtime, this one has a 2% max bet and a 2% house edge:
bash-3.2$ ./whale_sim.pl 10 25000 25000 0.02 101
roll_num => 6831, bet => 349.12, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 5577.00, jw => 3467, ww => 3364
roll_num => 2518, bet => 817.76, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 14035.39, jw => 1289, ww => 1229
roll_num => 217, bet => 604.93, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 24890.22, jw => 127, ww => 90
roll_num => 6483, bet => 917.34, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 4204.63, jw => 3291, ww => 3192
roll_num => 179, bet => 826.50, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 24830.54, jw => 107, ww => 72
roll_num => 2920, bet => 837.70, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 14270.50, jw => 1492, ww => 1428
roll_num => 713, bet => 236.40, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 20488.12, jw => 377, ww => 336
roll_num => 805, bet => 688.58, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 19237.02, jw => 424, ww => 381
roll_num => 315, bet => 58.77, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 22507.79, jw => 176, ww => 139
roll_num => 4534, bet => 501.58, jd_bal => 50000.00, whale_bal => 0.00, max => 50000.00, min => 12465.50, jw => 2307, ww => 2227
In trial 4 the house goes down to 4204
BTC!
Here's the source code for reference:
! /usr/bin/perl
#
# Simulation of a battle between a whale player and Just-Dice
#
# Purpose
# -------
# Theory is that the Kelly Criterion should keep the bank safe from ruin
# (though not from volatility) and eventually always cause the house to
# win the whale's roll.
#
# I am interested to see
# - if this is true in practice
# - how long might it take
# - how far the house might fall behind before it happens
#
# Assumptions
# -----------
# - Whale always bets the maximum.
# - If Just-Dice's roll drops below 250btc (1% of starting roll), it is all-in
# (just to give the Whale a chance of winning :-) )
# - Whale keeps betting until one or the other goes broke.
#
# Purpose
# -------
# Theory is that the Kelly Criterion should keep the bank safe from ruin
# (though not from volatility) and eventually always cause the house to
# win the whale's roll.
#
# I am interested to see
# - if this is true in practice
# - how long might it take
# - how far the house might fall behind before it happens
#
$num_trials = $ARGV[0];
for ($i=0; $i<$num_trials; $i++) {
$whale_bal = $ARGV[1];
$jd_bal = $ARGV[2];
$max_bet = $ARGV[3];
# bets in the range 0 -> $house_edge -> 199 win
$house_edge = $ARGV[4];
$report_freq = 100000;
# Keep track of the highest and lowest house balances seen
$jd_max = $jd_bal;
$jd_min = $jd_bal;
$jd_orig = $jd_bal;
while ( ($whale_bal > 0) && ($jd_bal > 0) ) {
$roll_num++;
if ( $jd_bal < ($jd_orig * $max_bet) ) {
$bet = $jd_bal;
} elsif ( $whale_bal < ($jd_bal * $max_bet) ) {
$bet = $whale_bal;
} else {
$bet = $jd_bal * $max_bet;
}
$roll = int(rand(200));
if ( $roll > $house_edge ) {
$whale_bal = $whale_bal + $bet;
$jd_bal = $jd_bal - $bet;
$whale_wins++;
} else {
$whale_bal = $whale_bal - $bet;
$jd_bal = $jd_bal + $bet;
$jd_wins++;
}
if ( $jd_bal > $jd_max ) {
$jd_max = $jd_bal;
} elsif ( $jd_bal < $jd_min ) {
$jd_min = $jd_bal;
}
if ( 0 == ($roll_num % $report_freq) ) {
printf ("roll_num => $roll_num, bet => %.2f, jd_bal => %.2f, whale_bal => %.2f, max => %.2f, min => %.2f, jw => $jd_wins, ww => $whale_wins\n", $bet, $j\
d_bal, $whale_bal, $jd_max, $jd_min);
}
}
printf ("roll_num => $roll_num, bet => %.2f, jd_bal => %.2f, whale_bal => %.2f, max => %.2f, min => %.2f, jw => $jd_wins, ww => $whale_wins\n", $bet, $jd_bal, $\
whale_bal, $jd_max, $jd_min);
}
exit 0;