Pages:
Author

Topic: PHP martingale bot for satoshiDICE - page 8. (Read 32867 times)

mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 09, 2012, 02:16:46 AM
#14
A PowerShell Version:
~~SNIP~~
If someone thinks this is worth a donation... 1J66vZHf1oFPHFhjFBtbEqxkJahdF3vetu

Thanks payb.tc for your nice PHP Script :0) Donation on the way

thats some nice powershell there Smiley

Powershell is microsofts attempt to return to unix roots and its not a bad start at it either.
The amount of stuff you can now automate/script via powershell (outlook accounts, AD operations etc) is fantastic.
hero member
Activity: 700
Merit: 507
May 09, 2012, 02:11:40 AM
#13
Thanks payb.tc for your nice PHP Script :0) Donation on the way

thanks very much Smiley

i'm not even sure i've heard of PowerShell... it looks a lot like php.


Powershelll is, simplified, Bash for Windows. Much nicer scripting than with old Batch files Wink
hero member
Activity: 700
Merit: 507
May 09, 2012, 01:50:47 AM
#12
A PowerShell Version:

Code:
Write-Host "Satoshidice"

$min_bet = 0.01
$max_bet = 0.1
$address = "1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp"


$bet = $min_bet
$total_fees = 0
$count = 0
$count_won = 0


$starting_balance = ./bitcoind getbalance

while ($bet -le $max_bet -AND $count_won -le 100) {

$count ++
$balance_a = ./bitcoind getbalance

$tx = ./bitcoind sendtoaddress "$address" $bet

$balance_b = ./bitcoind getbalance

$fee = $balance_a - $balance_b - $bet
$total_fees += $fee

Write-Host "Game: $count"
Write-Host "Balance: $balance_a"
Write-Host "Bet: $bet"
Write-Host "Fee: $fee"
Write-Host "Total Fees: $total_fees"
Write-Host –NoNewLine "Balance: $balance_b Waiting "

$balance_c = 0
$last_c = 0

while ($balance_b -ge $balance_c)
{
$balance_c = ./bitcoind getbalance

if(  ($balance_c -eq $last_c) -OR ($last_c -eq 0) )
{
Write-Host –NoNewLine "."
}else
{
Write-Host "Balance: $balance_c"
}

$last_c = $balance_c

}

$diff = $balance_c - $balance_b

if ($diff -gt $bet)
{
$bet = $min_bet
$count_won = $count_won + 1
Write-Host "Win! ($count_won out of $count)"
}else
{
$bet = $bet * 2
Write-Host "Lose!"
}

Write-Host ""
}


If someone thinks this is worth a donation... 1J66vZHf1oFPHFhjFBtbEqxkJahdF3vetu

Thanks payb.tc for your nice PHP Script :0) Donation on the way
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 08, 2012, 10:53:23 PM
#11
Martingale changes the odds from a very high chance of losing a small amount of money to a very small chance of losing a large amount of money. It can't change the house edge though, so the higher the chances of a profit, the higher the losses in the unlikely event of a loss.

Thats why I think playing a martingales system is for fools, you need to increase the reward as the risk increases.
3x instead of 2x is fun - dangerous but fun Smiley
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 08, 2012, 10:51:35 PM
#10
out of curiosity i went to random.org (with my browser) and manually pulled 20,000 numbers (0 or 1) to see how often there were long runs of the same number.
there were only about 4 or 5 which had 12+ and i think around 25 or so which had 10+

10 will put you at 1024btc and a total cumaltive bet of 2047 BTC (1024+512+256+128+64=32+16+8+4+1) with a profit of 32.744btc.

i hope anyone that takes my code and changes it will consider sharing their modifications publicly.
good luck with it!

Well mine is perl, but Im happy to share.
I think sim's will be really useful here to stop people hurting themselves Wink

x2.5 - x3.7 Is the range of my secret multiplier Wink (well close) as can be seen in the spreadsheet linked.. x2 = fools game of a 2x reward, ever increasing bets to win your original 2x your original bet back.

Good luck all.

There are some good stories of millionaires bankrupting  themselves by playing the martingale system to the bitter end at a casino (hot tip, casino's cheat).
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
May 08, 2012, 10:47:04 PM
#9
Martingale changes the odds from a very high chance of losing a small amount of money to a very small chance of losing a large amount of money. It can't change the house edge though, so the higher the chances of a profit, the higher the losses in the unlikely event of a loss.

A typical Martingale progression, for example, needs a $10,000 bankroll to give you a 99.85% chance of winning $10. In the very unlikely case that you lose, though, you'll lose your entire bankroll. If you don't have that large a bankroll, you can't lose as much. But the odds that you will lose your entire bankroll go up.
member
Activity: 64
Merit: 10
May 08, 2012, 10:41:57 PM
#8
As with any gambling venture, there is a chance of profits.. but there's an even greater chance of losses.

I hope no one will be misguided by that spreadsheet.  Tongue
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 08, 2012, 10:39:05 PM
#7
https://sheet.zoho.com/public/mem.namefix/memtingale-basic-sim

martingale sim in a spreadsheet for those that are interested.

I will post the perl sim tonight (allows simulating as many rounds as needed, 20'000 is usually what i run).
It dumps output to a nice html 9then opens in firefox) file and csv.
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
May 08, 2012, 10:32:42 PM
#6
I think you just invented a new kind of bitcoin mining.

those balances are real by the way... i started with exactly 10 btc.

...and expect to finish with approximately 0 btc once i've finished playing with this bot


Nice work, I was doing the same thing in perl last night (I use a modified martingale system).

I will post up my simulator tonight when I get home. I had some issues with GD Graph Lines generating graphed output (hates the negatives) so graphing the csv output is not supported yet.

I have to stress as someone who loves gambling and runs his own system these all fail and fail hard eventually.
You need to set a modest target profit then bail out when you hit it.

Using the vanilla martingale system with a x2 multiplier when the reward is *1.94 and not *2 will set you up to lose. I see you are using the 48.8281% chance 2.031x multiplier, this overcomes the issue while reducing odds in your favor.

I also have a spreadsheet on zoho docs I will share and post later (supposed to be working Tongue ), it plots out cumlative win, % odds of getting that far into the system.

Ive run my system at casino's on roulette and seen 14 straight blacks whens and last night when running sims against satoishi I saw 22 losses in a row - it can happen, be warned.

great script, Im going to use it as a reference to finish off mine (could not test last night due to the site being down).
legendary
Activity: 2506
Merit: 1010
May 08, 2012, 09:42:35 PM
#5
I love Satoshidice.  Fun as hell.  That being said... Scripting a -EV game is bad news...lol

New to the gaming field, had to look it up:

 - http://en.wikipedia.org/wiki/Expected_value
sr. member
Activity: 316
Merit: 250
May 08, 2012, 09:10:39 PM
#4
woah, woah, woah, forgot to mention:

THIS NEEDS IT'S OWN WALLET!

i couldn't get this to run properly from an 'account' within a wallet, because when SD sends payments it ends up going unpredictably in all of your accounts...

so this is running from it's own instance of bitcoind, it's own wallet, with nothing else accessing it.


Correct me if I'm missing something, but wouldn't this be solved by using 'sendfrom' instead of 'sendtoaddress'?
legendary
Activity: 1008
Merit: 1000
May 08, 2012, 08:36:10 PM
#3
I love Satoshidice.  Fun as hell.  That being said... Scripting a -EV game is bad news...lol
hero member
Activity: 784
Merit: 1000
bitcoin hundred-aire
May 08, 2012, 08:35:11 PM
#2
move to gambling forum?

Also, nice work, I might use the damn thing soon Tongue
hero member
Activity: 812
Merit: 1000
May 08, 2012, 08:33:27 PM
#1
so anyhooo, i went and wrote this script yesterday for playing satoshidice martingale-style.

it was a fun exercise, and i figure i'll share my complete code in case others find it fun/useful/interesting/noteworthy.

Code:
require_once('jsonRPCClient.php');
$b = new jsonRPCClient('http://YOURUSERNAME:[email protected]:8332/');

define('MIN_BET'0.01);
define('MAX_BET'6);
define('ADDRESS''1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp');

$bet MIN_BET;
$total_fees 0;
$count 0;
$count_won 0;

while ((
$bet <= MAX_BET) && ($count_won 100))
{
        
$count++;

        
$balance_a $b->getbalance('*'0);
        if (!isset(
$starting_balance)) $starting_balance $balance_a;
        
$b->sendtoaddress(ADDRESS, (float) $bet);
        
$balance_b $b->getbalance('*'0);

        
$fee $balance_a $balance_b $bet;
        
$total_fees += $fee;
        
$total_fees number_format($total_fees,8,'.','')+0;

        echo 
'Game #'.$count."\n";
        echo 
'Balance: ' $balance_a."       ";
        echo 
'Bet: '$bet."       ";
        echo 
'Fee: '. (number_format($fee8'.''') +0) . "       ";
        echo 
'Total Fees: '$total_fees"\n";
        echo 
'Balance: ' $balance_b "       ".'Waiting';

        
$balance_c 0;

        while (
$balance_b >= $balance_c)
        {
        sleep(4);
$balance_c $b -> getbalance('*'0);
echo '.';
        }

        echo 
"\nBalance: $balance_c       ";

        
$diff $balance_c $balance_b;

        if (
$diff $bet)
        {
                
$bet MIN_BET;
                
$count_won++;
                echo 
"Win! ($count_won out of $count)\n";
        }
        else
        {
                
$bet *= 2;
                echo 
'Lose!'."\n";
        }

        echo 
"\n";
}

echo 
'Starting Balance: '.$starting_balance."\n";
echo 
'Ending Balance  : '$balance_c."\n";
echo 
'Total Fees: '$total_fees."\n";
$amt_won $balance_c $starting_balance;
echo 
'Net Profit: '. (number_format($amt_won,8,'.','') + 0). "\n\n";

output looks something like...

Code:
Game #1
Balance: 11.37567619       Bet: 0.01       Fee: 0.0005       Total Fees: 0.0005
Balance: 11.36517619       Waiting...
Balance: 11.36521708       Lose!

Game #2
Balance: 11.36521708       Bet: 0.02       Fee: 0.0005       Total Fees: 0.001
Balance: 11.34471708       Waiting.........
Balance: 11.34479886       Lose!

Game #3
Balance: 11.34479886       Bet: 0.04       Fee: 0.0005       Total Fees: 0.0015
Balance: 11.30429886       Waiting...
Balance: 11.38554886       Win! (1 out of 3)

Game #4
Balance: 11.38554886       Bet: 0.01       Fee: 0.0005       Total Fees: 0.002
Balance: 11.37504886       Waiting.....
Balance: 11.37508975       Lose!

with a summary at the end somewhat like this:

Code:
Starting Balance: 11.37567619
Ending Balance  : 11.42477259
Total Fees: 0.006
Net Profit: 0.0490964

it's designed to run from the command-line by the way. it'll still work from a browser, but you may want to swap all the "\n" with '
' or something.

warning: the martingale method of betting isn't foolproof. this script may cause you to lose your entire balance.
warning 2: even if the martingale method of betting were foolproof, my php code may not be... use at your own risk.

if you like this and want to send me a few bits for the effort, 1CxzfAQo2UK9rppeQNvNmAFhApPqmdVR8y Cheesy
Pages:
Jump to: