Bitcoin Forum
November 12, 2024, 06:22:31 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: memtingale simulator  (Read 4929 times)
mem (OP)
Hero Member
*****
Offline Offline

Activity: 644
Merit: 501


Herp Derp PTY LTD


View Profile
May 09, 2012, 11:42:33 AM
Last edit: July 11, 2013, 05:07:43 AM by mem
 #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://bitcointalk.org/index.php?topic=80361.msg889952#msg889952
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.

mem (OP)
Hero Member
*****
Offline Offline

Activity: 644
Merit: 501


Herp Derp PTY LTD


View Profile
May 09, 2012, 11:44:56 AM
Last edit: May 09, 2012, 12:01:29 PM by mem
 #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 (OP)
Hero Member
*****
Offline Offline

Activity: 644
Merit: 501


Herp Derp PTY LTD


View Profile
May 09, 2012, 11:45:30 AM
Last edit: May 09, 2012, 11:58:11 AM by mem
 #3


memtingale.pl

Code:
#!/usr/bin/perl -w
#copyright mem.namefix@gmail.com , 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 =
"
<TR>
<TD><b>#</b></TD>
<TD><b>rand</b></TD>
<TD><b>Bet</b></TD>
<TD><b>win</b></TD>
<TD><b>cum</b></TD>
<TD><b>cum win</b></TD>
<TD><b>Profit</b></TD>
</TR>
";

print FILE
"
<HTML>
<pre>
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

</pre>

<TABLE border=1>
$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 = "<b>";
$b2 = "</b>";
}
else
{
$b1 = $b2 = "";
}

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

# output results to html file
print FILE
"
<TR>
<TD>$b1$c$b2</TD>
<TD bgcolor=$r_col>$b1$rand$b2</TD>

<TD bgcolor=pink>$b1$bet1$b2</TD>
<TD bgcolor=pink>$b1$bet1_win$b2</TD>
<TD bgcolor=pink>$b1$bet1_cum$b2</TD>
<TD bgcolor=pink>$b1$bet1_cum_win$b2</TD>
<TD bgcolor=pink>$b1$bet1_profit$b2</TD>
</TR>
";

#####################################################
# 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 "
<td>
<td bgcolor=red colspan=13>
<h1>LOSE</h1>
</td>
</td>
";
}

if($win)
{
print FILE "
<td>
<td bgcolor=red colspan=13>
<h1><b>WIN FACTOR $win_factor ACHIVED</b></h1>
</td>
</td>
";
}
print FILE "</table></html>";
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;

terrytibbs
Hero Member
*****
Offline Offline

Activity: 560
Merit: 501



View Profile
May 09, 2012, 11:48:40 AM
 #4

Code:
$bet1_cum=0;
mem (OP)
Hero Member
*****
Offline Offline

Activity: 644
Merit: 501


Herp Derp PTY LTD


View Profile
May 09, 2012, 11: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.

Grover
Full Member
***
Offline Offline

Activity: 137
Merit: 100


I was thinking Stay Puft, but Gozer said Grover


View Profile
March 26, 2013, 11: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.
gmiwenht
Member
**
Offline Offline

Activity: 115
Merit: 10


View Profile
March 27, 2013, 08:32:53 PM
Last edit: March 29, 2013, 04:06:11 PM by gmiwenht
 #7

[deleted]

1xsBEUVzo6EtAST5Bq96AztiTR5mBXNzt
Grover
Full Member
***
Offline Offline

Activity: 137
Merit: 100


I was thinking Stay Puft, but Gozer said Grover


View Profile
March 27, 2013, 10: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.
gmiwenht
Member
**
Offline Offline

Activity: 115
Merit: 10


View Profile
March 28, 2013, 05:10:23 AM
Last edit: March 29, 2013, 04:06:01 PM by gmiwenht
 #9

[deleted]

1xsBEUVzo6EtAST5Bq96AztiTR5mBXNzt
Grover
Full Member
***
Offline Offline

Activity: 137
Merit: 100


I was thinking Stay Puft, but Gozer said Grover


View Profile
March 28, 2013, 07:03:03 AM
Last edit: March 28, 2013, 07:15:32 AM by Grover
 #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!
GCInc.
Hero Member
*****
Offline Offline

Activity: 566
Merit: 500


View Profile WWW
March 29, 2013, 04:57:40 PM
 #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

Grover
Full Member
***
Offline Offline

Activity: 137
Merit: 100


I was thinking Stay Puft, but Gozer said Grover


View Profile
March 29, 2013, 06:11:27 PM
Last edit: March 29, 2013, 09:55:04 PM by Grover
 #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://bitcointalk.org/index.php?topic=160852.0
GCInc.
Hero Member
*****
Offline Offline

Activity: 566
Merit: 500


View Profile WWW
March 29, 2013, 06:41:51 PM
 #13

There's a separate thread for issues, please use that at https://bitcointalk.org/index.php?topic=160852.0

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

mem (OP)
Hero Member
*****
Offline Offline

Activity: 644
Merit: 501


Herp Derp PTY LTD


View Profile
April 29, 2013, 07: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.

Financisto
Hero Member
*****
Offline Offline

Activity: 640
Merit: 771

BTC⇆⚡⇄BTC


View Profile WWW
July 05, 2013, 08: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...

LIST • ESCROW providers • Ranking & ScoresLIST • FOSS BrainwalletsBTC ⇆⚡⇄ BTCBTC aka BTC: 16MBvhaJoRBxW3Vk6apnvz3UYT9HAgraVS ⚡ PGP: 2680207AA9A1B69FE7A033D80DE0F221074384C4 ⚡ If you think freedom matters, please support the development of these privacy projects→DONATE some sats: TailsQubes OSWhonixVeraCryptPicocryptKryptorSimpleX Chat
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
July 05, 2013, 09: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%).
Financisto
Hero Member
*****
Offline Offline

Activity: 640
Merit: 771

BTC⇆⚡⇄BTC


View Profile WWW
July 05, 2013, 09: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

LIST • ESCROW providers • Ranking & ScoresLIST • FOSS BrainwalletsBTC ⇆⚡⇄ BTCBTC aka BTC: 16MBvhaJoRBxW3Vk6apnvz3UYT9HAgraVS ⚡ PGP: 2680207AA9A1B69FE7A033D80DE0F221074384C4 ⚡ If you think freedom matters, please support the development of these privacy projects→DONATE some sats: TailsQubes OSWhonixVeraCryptPicocryptKryptorSimpleX Chat
Financisto
Hero Member
*****
Offline Offline

Activity: 640
Merit: 771

BTC⇆⚡⇄BTC


View Profile WWW
July 05, 2013, 09: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

LIST • ESCROW providers • Ranking & ScoresLIST • FOSS BrainwalletsBTC ⇆⚡⇄ BTCBTC aka BTC: 16MBvhaJoRBxW3Vk6apnvz3UYT9HAgraVS ⚡ PGP: 2680207AA9A1B69FE7A033D80DE0F221074384C4 ⚡ If you think freedom matters, please support the development of these privacy projects→DONATE some sats: TailsQubes OSWhonixVeraCryptPicocryptKryptorSimpleX Chat
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
July 05, 2013, 01:08:51 PM
 #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 mem.namefix@gmail.com , 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 =
"
<TR>
<TD><b>#</b></TD>
<TD><b>rand</b></TD>
<TD><b>Bet</b></TD>
<TD><b>win</b></TD>
<TD><b>cum</b></TD>
<TD><b>cum win</b></TD>
<TD><b>Profit</b></TD>
</TR>
";

print FILE
"
<HTML>
<pre>
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

</pre>

<TABLE border=1>
$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 = "<b>";
$b2 = "</b>";
}
else
{
$b1 = $b2 = "";
}

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

# output results to html file
print FILE
"
<TR>
<TD>$b1$c$b2</TD>
<TD bgcolor=$r_col>$b1$rand$b2</TD>

<TD bgcolor=pink>$b1$bet1$b2</TD>
<TD bgcolor=pink>$b1$bet1_win$b2</TD>
<TD bgcolor=pink>$b1$bet1_cum$b2</TD>
<TD bgcolor=pink>$b1$bet1_cum_win$b2</TD>
<TD bgcolor=pink>$b1$bet1_profit$b2</TD>
</TR>
";

#####################################################
# 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 "
<td>
<td bgcolor=red colspan=13>
<h1>LOSE</h1>
</td>
</td>
";
}

if($win)
{
print FILE "
<td>
<td bgcolor=red colspan=13>
<h1><b>WIN FACTOR $win_factor ACHIVED</b></h1>
</td>
</td>
";
}
print FILE "</table><hr># of wins: $num_wins<br># of losses: $num_losses</html>";
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.
Financisto
Hero Member
*****
Offline Offline

Activity: 640
Merit: 771

BTC⇆⚡⇄BTC


View Profile WWW
July 05, 2013, 08:00:41 PM
 #20

Thank you again!

LIST • ESCROW providers • Ranking & ScoresLIST • FOSS BrainwalletsBTC ⇆⚡⇄ BTCBTC aka BTC: 16MBvhaJoRBxW3Vk6apnvz3UYT9HAgraVS ⚡ PGP: 2680207AA9A1B69FE7A033D80DE0F221074384C4 ⚡ If you think freedom matters, please support the development of these privacy projects→DONATE some sats: TailsQubes OSWhonixVeraCryptPicocryptKryptorSimpleX Chat
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!