Pages:
Author

Topic: memtingale simulator - page 2. (Read 4944 times)

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.
Pages:
Jump to: