Author

Topic: memtingale simulator (Read 4937 times)

mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
July 11, 2013, 12:00:17 AM
#24
hey people are still using my script Cheesy glad to see it.

It's the best customizable simulator around for that matter.

By the way, your gambling list is the most professional around too.

I liked the criterions that you chose in order to order the casinos.

Anonymous Casinos + BTC = more transparency needed

Keep up the good work!

flattery will get you everywhere Smiley

I also write/ wrote:

namefix.pl: the best batch file renamer (linux, mac, win)
wiicr: day 0 / first homebrewer* to allow playing mp3's and videos via the nintendo wii
arby.pl: an arbitrage calculator for BTC-e, offline currently as it was chewing resources Tongue
FYGP: Fuck Your Group Policy - a very handy app that is damn near impossible to uninstall (on purpose) and auto installs every time its executed (yer it acts like a virus). Its entire point being to over ride desktop backgrounds on domain workstations (a company I worked at forced a horrible bright white and green bg).

and thats just what I bother to share Wink
when you release a free app or script quite often you are hounded for support so I keep many of my hacks to myself Wink

This script was an ugly hack as well, but I used it to develop my own version of the martingale system which I have played to good success (won heaps and never used it again). I released this one because it seemed to many players failed to see the pitfalls of martingales system.
hero member
Activity: 640
Merit: 771
BTC⇆⚡⇄BTC
July 10, 2013, 08:27:27 PM
#23
hey people are still using my script Cheesy glad to see it.

It's the best customizable simulator around for that matter.

By the way, your gambling list is the most professional around too.

I liked the criterions that you chose in order to order the casinos.

Anonymous Casinos + BTC = more transparency needed

Keep up the good work!
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
July 10, 2013, 07:48:35 AM
#22
mem personal question what is your race

NASCAR !!!!
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
July 10, 2013, 07:41:39 AM
#21
hey people are still using my script Cheesy glad to see it.
hero member
Activity: 640
Merit: 771
BTC⇆⚡⇄BTC
July 05, 2013, 03:00:41 PM
#20
Thank you again!
hero member
Activity: 728
Merit: 500
July 05, 2013, 08:08:51 AM
#19
Quote
Make the code keep track of how often a 0 is rolled and how often it ends up with a 1. Compare these numbers and they should be close to 50% with a large enough run (In a run with 1 milion samples, with 95% certainty, the percentage of zeroes should fall between 49.8% and 50.2%).

Btw, is that simple to implement?

Sorry I'm damn noob programming that kind of stuff yet...  Undecided

I don't have experience with Perl (the language used for Mems script), but since I have used plenty of other languages, it should be straightforward. A slightly modified version of the script posted by Mem:

Code:
#!/usr/bin/perl -w
#copyright [email protected] , License http://www.gnu.org/licenses/gpl.html

$incr = 2.5;
$win = 0;

$num_wins = 0;
$num_losses = 0;

$bet_start = 0.03;
$bet1=$bet_start;
$bet1_cum=0;
$bet1_profit=0;
$bet1_win=0;
$bet1_cum_win=0;
$bet1_reset=0;

$pot=3000; # amount of cash we have to play with

$table_max=100;
$hitmax=0; # should we goto table max before reseting if next bet would be greater than table max

# reset bets if we have won N amount recently.
# the idea is it stops the odds getting out of control and simulates seprate games if you played to N amount each time

$profit = 0;

$count=20000;
$c=0;

$b1="";

$lose_multiplier = 0.004089;
$win_multiplier = 1.984;

$win_factor = 3;

$r=rand;
$outfile = "/tmp/gamblingsim.$r.html";
$log_outfile = "/tmp/gamblingsim.$r.log";

open(FILE, ">$outfile") or die "couldnt open html file $!\n";
open(FILE_LOG, ">$log_outfile") or die "couldnt open log file $!\n";

$headercount=0;
$header =
"

#
rand
Bet
win
cum
cum win
Profit

";

print FILE
"


Max rounds to play: $count
Pot: \$$pot
table_max \$$table_max

Win Factor Potx$win_factor

bet increment multiplier $incr

Hit table max bet ?: $hitmax




$header
";

for($c=0;$c<$count;$c++)
{
$bet1_win = 0;
$bet1_cum += $bet1;

$rand = int(rand(2)); # 0 = win, 1 = lose

# bet wins
$bet1_win = 0;
if($rand == 0)
{
$bet1_win = $bet1 * $win_multiplier;
                $num_wins++;
}
else
{
$bet1_win = $bet1 * $lose_multiplier;
                $num_losses++;
}
$bet1_cum_win += $bet1_win;

# calculate profits etc

$bet1_profit = $bet1_cum_win - $bet1_cum;
$profit = $bet1_profit;

# ========================
# End Game Checks

if($profit < (0-$pot)) # check to see if we are out of money
{
$lose = 1;
last;
}

# stop if hit target profit
if($profit > ($pot * $win_factor))
{
$win=1;
last;
}

# html stuff
# set html table colours

$headercount++;
if($headercount>10)
{
print FILE $header;
$headercount=0;
}

if($rand == 0)
{
$r_col = "green";
}
elsif($rand == 1)
{
$r_col = "red";
}

# bold profit when we are at a posiive balance
if($profit > 0)
{
$b1 = "";
$b2 = "
";
}
else
{
$b1 = $b2 = "";
}

# output results to csv file
print FILE_LOG "$c,$bet1,$bet1_profit\n";

# output results to html file
print FILE
"










";

#####################################################
# SET BETS FOR NEXT ROUND

# increment bet amounts if didnt win last bet.
$bet1*= $incr;

if($rand == 0)
{
$bet1 = $bet_start;
}

# TABLE MAX, reset bets

if($bet1_reset == 1)
{
$bet1=$bet_start;
$bet1_reset=0;
}

if($bet1>$table_max)
{
if($hitmax)
{
$bet1=$table_max;
$bet1_reset =1;
}
else
{
$bet1=$bet_start;
}
}
}

if($lose)
{
print FILE "


";
}

if($win)
{
print FILE "


";
}
print FILE "
$b1$c$b2 $b1$rand$b2 $b1$bet1$b2 $b1$bet1_win$b2 $b1$bet1_cum$b2 $b1$bet1_cum_win$b2 $b1$bet1_profit$b2


LOSE




WIN FACTOR $win_factor ACHIVED



# of wins: $num_wins
# of losses: $num_losses";
close(FILE);
close(FILE_LOG);

#system("/home/mem/apps/gambling/chartit.pl $log_outfile");
#system("firefox $outfile && firefox $log_outfile.png");
system("firefox $outfile");

sleep(1);

exit 0;

In addition to doing all the usual stuff, this modified script also keeps track of the total number of wins (random number = 0) and losses (random number = 1) and adds that to the output file.
hero member
Activity: 640
Merit: 771
BTC⇆⚡⇄BTC
July 05, 2013, 04:33:03 AM
#18
Quote
Make the code keep track of how often a 0 is rolled and how often it ends up with a 1. Compare these numbers and they should be close to 50% with a large enough run (In a run with 1 milion samples, with 95% certainty, the percentage of zeroes should fall between 49.8% and 50.2%).

Btw, is that simple to implement?

Sorry I'm damn noob programming that kind of stuff yet...  Undecided
hero member
Activity: 640
Merit: 771
BTC⇆⚡⇄BTC
July 05, 2013, 04:29:45 AM
#17
@Rannasha

Thanks for the help.

I guess I got a little confused with that codes and didn't pay so much attention to that.

Now it's working fine: every simulation shows a complete disaster in terms of bankroll.  Grin
hero member
Activity: 728
Merit: 500
July 05, 2013, 04:10:15 AM
#16
One funny stuff: I've just simulated some neutral expected value (0EV) scenarios changing the following lines.
Code:
$lose_multiplier = 0; #  0EV

Then I ran a million bets and got profit as a result every time considering that:
Code:
$incr =  2.2; # always > 2
$bet_start = 0.5; # 0.5% of bankroll.
$pot=100;
$table_max=2.42; # 3rd and last consecutive bet.
$hitmax=1; # resets after 3rd consecutive loss.
$win_multiplier = $incr; # no house's edge / vig / juice.
Your win_multiplier is 2.2 (equal to $incr). That means you're simulating a game where if you win a coinflip, you get 2.2 your bet back (and 0 if you lose). That's a positive EV for the better in any circumstance (no need to martingale it, just straight up bet 1 unit at a time and watch profits rise).

For a no house edge game, you need to set $win_multiplier to 2.

Quote
So I ask you, do that functions...
Code:
$r=rand;
$rand = int(rand(2)); # 0 = win, 1 = lose

...really give us 50% rate (win/lose) as expected?

It seems like I got over 50% winning rate.
Make the code keep track of how often a 0 is rolled and how often it ends up with a 1. Compare these numbers and they should be close to 50% with a large enough run (In a run with 1 milion samples, with 95% certainty, the percentage of zeroes should fall between 49.8% and 50.2%).
hero member
Activity: 640
Merit: 771
BTC⇆⚡⇄BTC
July 05, 2013, 03:54:54 AM
#15
@mem

Thank you so much for creating that perl script.

I've been looking for a customizable martingale simulator tool like that for so long.

It really adds up to my statistical studies and math scraps as well.

One funny stuff: I've just simulated some neutral expected value (0EV) scenarios changing the following lines.
Code:
$lose_multiplier = 0; #  0EV

Then I ran a million bets and got profit as a result every time considering that:
Code:
$incr =  2.2; # always > 2
$bet_start = 0.5; # 0.5% of bankroll.
$pot=100;
$table_max=2.42; # 3rd and last consecutive bet.
$hitmax=1; # resets after 3rd consecutive loss.
$win_multiplier = $incr; # no house's edge / vig / juice.

I was hoping for a near no-profit / no-loss situation due to the Law of Large Numbers but got profit in all situations simulated.

Isn't that strange?

So I ask you, do that functions...
Code:
$r=rand;
$rand = int(rand(2)); # 0 = win, 1 = lose

...really give us 50% rate (win/lose) as expected?

It seems like I got over 50% winning rate.

Maybe the algorithm is not that fair enough.

Very strange though...
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
April 29, 2013, 02:37:29 AM
#14
We decided to refine on mem's excellent idea and crafted our own simulator. It's now online at http://botdice.com. There are quite a bunch of options to control a more interesting bet progression schedule. Plain Martingale is for dummies Tongue

How flattering Cheesy

Glad people like it.
hero member
Activity: 566
Merit: 500
March 29, 2013, 01:41:51 PM
#13
There's a separate thread for issues, please use that at https://bitcointalksearch.org/topic/botdice-online-simulator-play-100k-just-dice-satoshidice-rounds-for-free-160852

Could you paste your bet settings from the result page, and a snippet of erroneous rows, it's quite difficult to make sense of what's wrong otherwise. Yes there probably are errors in the code at this stage.

Quote
Then max increase amount is based on balance of bank or amount of bank at risk for the game.
Increase amounts are currently only static. You can't have everything at first sight  Wink
full member
Activity: 137
Merit: 100
I was thinking Stay Puft, but Gozer said Grover
March 29, 2013, 01:11:27 PM
#12
We decided to refine on mem's excellent idea and crafted our own simulator. It's now online at http://botdice.com. There are quite a bunch of options to control a more interesting bet progression schedule. Plain Martingale is for dummies Tongue

Cool idea.

Original post moved here: https://bitcointalksearch.org/topic/botdice-online-simulator-play-100k-just-dice-satoshidice-rounds-for-free-160852
hero member
Activity: 566
Merit: 500
March 29, 2013, 11:57:40 AM
#11
We decided to refine on mem's excellent idea and crafted our own simulator. It's now online at http://botdice.com. There are quite a bunch of options to control a more interesting bet progression schedule. Plain Martingale is for dummies Tongue
full member
Activity: 137
Merit: 100
I was thinking Stay Puft, but Gozer said Grover
March 28, 2013, 02:03:03 AM
#10
Yeah I saw the warning and I ignored it cause I roll that way.
Quote
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

mem thanks for the sim.  It helped me change my perspective on gambling at SD.  Now instead of betting for the wins I bet small to find the losses and then hopefully have the room to memingdale my bets till I find all the consecutive losses and get a win.

you mean like bet 0.01 to catch a run of 5-6 losses, and then start betting big to increase your chances of winning?

that is fucking retarded

Yeap. I was doing martingale but starting too high.  Now I do a smaller start and increase by over 2, so when I find the next win I win more than what my first small win would have been if it was not a loss.

And good thing you've found a use for your lack of talent.

Holy shit, you are actually serious. Although it may appear comforting, your strategy makes no sense. Please don't think I am trolling you, I really am somewhat concerned that you actually believe this.

See this for a start:
http://en.wikipedia.org/wiki/Markov_property

If you have any questions or would like me to convince you further, please ask. I would be happy to elaborate in as much detail as needed. Perhaps someone else can chime in too. This is gambler's fallacy 101.



It's called GAMBLING!

Yes I'm full well aware that I am just as likely to lose enough bets in a row so that I no longer have the funds from which to double my bet.

It was playing with the sim that showed me I was not taking into account enough iterations.

Again, It's called GAMBLING!

Plus it's exciting.  I've increased my starting amount 4x, and who knows I may lose all of it when SD is back up.

Oh yeah. It's called GAMBLING!
member
Activity: 115
Merit: 10
March 28, 2013, 12:10:23 AM
#9
[deleted]
full member
Activity: 137
Merit: 100
I was thinking Stay Puft, but Gozer said Grover
March 27, 2013, 05:10:58 PM
#8
Yeah I saw the warning and I ignored it cause I roll that way.
Quote
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

mem thanks for the sim.  It helped me change my perspective on gambling at SD.  Now instead of betting for the wins I bet small to find the losses and then hopefully have the room to memingdale my bets till I find all the consecutive losses and get a win.

you mean like bet 0.01 to catch a run of 5-6 losses, and then start betting big to increase your chances of winning?

that is fucking retarded

Yeap. I was doing martingale but starting too high.  Now I do a smaller start and increase by over 2, so when I find the next win I win more than what my first small win would have been if it was not a loss.

And good thing you've found a use for your lack of talent.
member
Activity: 115
Merit: 10
March 27, 2013, 03:32:53 PM
#7
[deleted]
full member
Activity: 137
Merit: 100
I was thinking Stay Puft, but Gozer said Grover
March 26, 2013, 06:06:47 PM
#6
Yeah I saw the warning and I ignored it cause I roll that way.
Quote
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

mem thanks for the sim.  It helped me change my perspective on gambling at SD.  Now instead of betting for the wins I bet small to find the losses and then hopefully have the room to memingdale my bets till I find all the consecutive losses and get a win.
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 09, 2012, 06:50:29 AM
#5
Code:
$bet1_cum=0;

damn you I needed that spot Tongue

and yes, funny name - but on private releases its whatever is short, obvious and easy to type.
hero member
Activity: 560
Merit: 501
May 09, 2012, 06:48:40 AM
#4
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 09, 2012, 06:45:30 AM
#3

memtingale.pl

Code:
#!/usr/bin/perl -w
#copyright [email protected] , License http://www.gnu.org/licenses/gpl.html

$incr = 2.5;
$win = 0;

$bet_start = 0.03;
$bet1=$bet_start;
$bet1_cum=0;
$bet1_profit=0;
$bet1_win=0;
$bet1_cum_win=0;
$bet1_reset=0;

$pot=3000; # amount of cash we have to play with

$table_max=100;
$hitmax=0; # should we goto table max before reseting if next bet would be greater than table max

# reset bets if we have won N amount recently.
# the idea is it stops the odds getting out of control and simulates seprate games if you played to N amount each time

$profit = 0;

$count=20000;
$c=0;

$b1="";

$lose_multiplier = 0.004089;
$win_multiplier = 1.984;

$win_factor = 3;

$r=rand;
$outfile = "/tmp/gamblingsim.$r.html";
$log_outfile = "/tmp/gamblingsim.$r.log";

open(FILE, ">$outfile") or die "couldnt open html file $!\n";
open(FILE_LOG, ">$log_outfile") or die "couldnt open log file $!\n";

$headercount=0;
$header =
"

#
rand
Bet
win
cum
cum win
Profit

";

print FILE
"


Max rounds to play: $count
Pot: \$$pot
table_max \$$table_max

Win Factor Potx$win_factor

bet increment multiplier $incr

Hit table max bet ?: $hitmax




$header
";

for($c=0;$c<$count;$c++)
{
$bet1_win = 0;
$bet1_cum += $bet1;

$rand = int(rand(2)); # 0 = win, 1 = lose

# bet wins
$bet1_win = 0;
if($rand == 0)
{
$bet1_win = $bet1 * $win_multiplier;

}
else
{
$bet1_win = $bet1 * $lose_multiplier;
}
$bet1_cum_win += $bet1_win;

# calculate profits etc

$bet1_profit = $bet1_cum_win - $bet1_cum;
$profit = $bet1_profit;

# ========================
# End Game Checks

if($profit < (0-$pot)) # check to see if we are out of money
{
$lose = 1;
last;
}

# stop if hit target profit
if($profit > ($pot * $win_factor))
{
$win=1;
last;
}

# html stuff
# set html table colours

$headercount++;
if($headercount>10)
{
print FILE $header;
$headercount=0;
}

if($rand == 0)
{
$r_col = "green";
}
elsif($rand == 1)
{
$r_col = "red";
}

# bold profit when we are at a posiive balance
if($profit > 0)
{
$b1 = "";
$b2 = "
";
}
else
{
$b1 = $b2 = "";
}

# output results to csv file
print FILE_LOG "$c,$bet1,$bet1_profit\n";

# output results to html file
print FILE
"










";

#####################################################
# SET BETS FOR NEXT ROUND

# increment bet amounts if didnt win last bet.
$bet1*= $incr;

if($rand == 0)
{
$bet1 = $bet_start;
}

# TABLE MAX, reset bets

if($bet1_reset == 1)
{
$bet1=$bet_start;
$bet1_reset=0;
}

if($bet1>$table_max)
{
if($hitmax)
{
$bet1=$table_max;
$bet1_reset =1;
}
else
{
$bet1=$bet_start;
}
}
}

if($lose)
{
print FILE "


";
}

if($win)
{
print FILE "


";
}
print FILE "
$b1$c$b2 $b1$rand$b2 $b1$bet1$b2 $b1$bet1_win$b2 $b1$bet1_cum$b2 $b1$bet1_cum_win$b2 $b1$bet1_profit$b2


LOSE




WIN FACTOR $win_factor ACHIVED


";
close(FILE);
close(FILE_LOG);

#system("/home/mem/apps/gambling/chartit.pl $log_outfile");
#system("firefox $outfile && firefox $log_outfile.png");
system("firefox $outfile");

sleep(1);

exit 0;
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 09, 2012, 06:44:56 AM
#2
Simple memtingale (xls) Usage:
Set Start Bet - (minimum bet).
Set Increase By - (bet multiplier). It must be 2 (classic martingale) or higher (memtingale Tongue ) to make a profit.
Set Reward - This is the multiplier applied to your bet, eg x1.984 for the 50% chance dice roll.
Set Win Odds - The chance your bet has of winning.
Lose Odds - are automatically calculated.



memtingale.pl Usage:
You need to edit the variables  Tongue
hopefully its obvious looking @ the code Tongue, this is an unreleased app so I have not added the usual config options & files.

Set $incr - multiplier used for next bet if lose.
Set $pot - amount of btc/usd to start with.
Set $table_max - Maximum bet
Set $hitmax - 1=on,0=off, should we go to the maximum bet before resetting ? ie $hitmax=1; table_max=50; #bet sequence 1,3,9,27,50
Set $win_factor - amount of profit to stop at, eg: $win_factor=3; $pot=100; # stop at 300
Set $count - Number of rounds to play (assuming you do not lose earlier) before stopping. Warning large numbers of rounds may strain your pc when loading the html (sorry about the tables Tongue )

it outputs a html file (opened by firefox) and a csv (for graphing) to /tmp
windows users may want to create C:/tmp if it does not exist and change:
Code:
$outfile = "/tmp/gamblingsim.$r.html";
$log_outfile = "/tmp/gamblingsim.$r.log";
to
Quote
$outfile = "c:/tmp/gamblingsim.$r.html";
$log_outfile = "c:/tmp/gamblingsim.$r.log";
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 09, 2012, 06:42:33 AM
#1
First posted in reply to payb.tc's cool php martingale bot for satoshiDICE.
Im also writting a perl bot for satoshiDICE, but payb.tc's beat me to it Wink
Below is a simple version (excel) and a proper sim written in perl.
This is an extremely basic Sim, I have a much more advanced one written in perl that I will post later.

Simple memtingale simulator (xls) https://public.sheet.zoho.com/public/mem.namefix/memtingale-sim

Advanced memtingale simulator (perl) https://bitcointalksearch.org/topic/m.889952
example output: http://members.iinet.net.au/~mem2/gamblingsim.0.39087819036013.html


Note: From countless Sims I can safely tell you martingales system is a fools game as no matter how high the stakes you are only making a profit equal to your original bet (assuming x2 reward multiplier). By doing a memtingale (my system, Ive yet to see anyone else use it) and increasing by a factor greater than 2 you are adding a increased reward for increased risk..

WARNINGS

Law of odds/random/thumb and mem say that all gambling systems will eventually fail and fail hard because sooner or later you will get a huge string of losses (Ive witnessed 22 on my sim and 14 in a live casino) from which you will not be able to recover from unless:
  • You have an unlimited supply of money
  • There is no maximum bet


This being said, they are incredibly fun to play and have the "illusion of working", but played long enough in a real world scenario and it will fail.

I will post my simulator up here later on tonight, its a perl script that sims games (originally aimed at roulette but now aimed at satoshidice). It allows you to simulate a real game, the sim runs until N rounds (user set - I use 20'000) or until you hit target profit (user set, I use 3x pot) or you lose all you money.


(warning, story time with mem)
If you do decide to try this on a pokie machine be aware that there is some BS that  goes on with the random number selection.
From my limited understanding (and while  this may apply for Australia it may not for your country) Pokie machines are required by law to have a selection of random numbers played through - ie a block is generated and all numbers must be used before cycling. This seems fair, but what they dont tell you is the machine can select any of the remaining numbers as a result.
The machines will idle in friendly mode (unless low on funds, or losing numbers) which has a good payout ratio. This is the ideal time to hit it with a memtingale attack.

If/when a pokie detects a martingale attack expect to get slammed with as many losses as required to bankrupt you. I got to witness this on a bank of 8 interconnected pokies, all the senior citizens were having a nice run, I turned up and emptied the machines 2x ($500 AUD each time) after the 1st cash out I had 2 security guards eyeballing my every move, a small fan club of old ladies watching me play. After the 2nd cashout the game switched to "fuck you" mode (unloads all the shitty numbers it has been storing up) and I witnessed the entire line of pokies lose again and again and again, I myself got a streak of 14 losses at which point I flipped off the security guards, cashed out and went home Wink

If you decide to do this at a casino with a real roulette table be very aware that casino's cheat, it may be as simple as stopping the table and re weighting the wheel or worse, they simply wait until your on a 10+ loss run and politely ask you to leave/ kick you out.
The main point being is they stop you incrementing the bet to recover your losses.
Jump to: