Bitcoin Forum

Economy => Gambling => Topic started by: Eildosa on August 03, 2015, 01:18:15 PM



Title: Quick and dirty python martingale calculator
Post by: Eildosa on August 03, 2015, 01:18:15 PM
Hi,

I know that you can get a loosing strike and hit your bankroll limit, but somehow I feel safe playing martingale.
I made this script 10 minutes ago, since in dice you don't always need to double after a loss, it depends of
what the payout is.

Code:
def martingale(current_bet, payout):
    lost = 0
    x = 1
    while True:
        lost = lost + current_bet
        print "draw %s" %(x)
        print "lost %s" %lost
        while(current_bet*payout<=lost):
            current_bet = current_bet+1
        print "next bet : %s in order to win %s for a profit of %s" %(current_bet, current_bet*payout, current_bet*payout-lost)
        x = x + 1
        user_choice = raw_input("continue (c) / reset (r) : ")
        print "\n"
        if user_choice == "r":
            return

while True:
    print "================================================================"
    print "==================- dice martingale calculator -================"
    print "================================================================"
    current_bet = raw_input("initial_bet : ")
    payout = raw_input("payout : ")
    martingale(int(current_bet), int(payout))
    print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
    print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"

Do what you want with it.

How to use (for windows, if you use linux you'r probably a techie anyway) :
-install python 2.7 : https://www.python.org/downloads/release/python-2710/
-create a new environment variable  (http://www.computerhope.com/issues/ch000549.htm) called PYTHON_HOME pointing to C:\Python27 (or wherever you installed it)
-add this to the PATH environment variable ;%PYTHON_HOME%;%PYTHON_HOME%\Scripts
-create a script.py and open it with notepad, paste the script inside
-shift plus right clic in the folder where the script is and select open a cmd windows here
-type : nameOfScript.py and press enter

Explanation :
1/ you installed python in order to run the script
2/ creating this environment variable allow you to just type the name of the script in the command line instead of "C:\Python27\python.exe nameOfTheScript.py"

the script begin and it should be user friendly enought


Title: Re: Quick and dirty python martingale calculator
Post by: LiQuidx on August 03, 2015, 01:53:02 PM
Hi,

I know that you can get a loosing strike and hit your bankroll limit, but somehow I feel safe playing martingale.
I made this script 10 minutes ago, since in dice you don't always need to double after a loss, it depends of
what the payout is.

Code:
def martingale(current_bet, payout):
    lost = 0
    x = 1
    while True:
        lost = lost + current_bet
        print "draw %s" %(x)
        print "lost %s" %lost
        while(current_bet*payout<=lost):
            current_bet = current_bet+1
        print "next bet : %s in order to win %s for a profit of %s" %(current_bet, current_bet*payout, current_bet*payout-lost)
        x = x + 1
        user_choice = raw_input("continue (c) / reset (r) : ")
        print "\n"
        if user_choice == "r":
            return

while True:
    print "================================================================"
    print "==================- dice martingale calculator -================"
    print "================================================================"
    current_bet = raw_input("initial_bet : ")
    payout = raw_input("payout : ")
    martingale(int(current_bet), int(payout))
    print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
    print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"

Do what you want with it.

I'm sure that a lot of people don't know what are the pre-requisites and how to run a python script so it would be a nice idea if you include some kind of info about it. :)


Title: Re: Quick and dirty python martingale calculator
Post by: GiocareHost on August 03, 2015, 03:38:27 PM
But in the end its the luck rather than maths in gambling that matters.
Albeit I checked the script worked fine for me.


Title: Re: Quick and dirty python martingale calculator
Post by: Dennis7777 on August 03, 2015, 03:46:09 PM
How to use (for windows, if you use linux you'r probably a techie anyway) :
-install python 2.7 : https://www.python.org/downloads/release/python-2710/
-create a new environment variable  (http://www.computerhope.com/issues/ch000549.htm) called PYTHON_HOME pointing to C:\Python27 (or wherever you installed it)
-add this to the PATH environment variable ;%PYTHON_HOME%;%PYTHON_HOME%\Scripts
-create a script.py and open it with notepad, paste the script inside
-shift plus right clic in the folder where the script is and select open a cmd windows here
-type : nameOfScript.py and press enter

Explanation :
1/ you installed python in order to run the script
2/ creating this environment variable allow you to just type the name of the script in the command line instead of "C:\Python27\python.exe nameOfTheScript.py"

the script begin and it should be user friendly enought

For those not so familiar with python or programming, they can also run the code on http://www.tutorialspoint.com/execute_python_online.php easily.


Title: Re: Quick and dirty python martingale calculator
Post by: anderson00673 on August 03, 2015, 03:51:20 PM
Just curious, what success have you had (the op) with martingale?  I assume from your post that you are not playing a straight up 50/50, but some other odds like 80/20?  Or something like that?  You play it on dice right?


Title: Re: Quick and dirty python martingale calculator
Post by: Eildosa on August 03, 2015, 06:45:31 PM
right now I'm experimenting with coinroyal's free credit (discovered dice games yesterday)

I'm using a 6.6% chance in order to get a 15x payout.
the longest loosing strike I got was a 31 draw.
Always rolling high.

I think I'm going to change the script in order to get at least 100 of profit for each draw, may be I'll make a bot.

It's funny to do, but as said, math state that at one point I will loose everything, so is a bot really required?


Title: Re: Quick and dirty python martingale calculator
Post by: Eildosa on August 03, 2015, 07:09:43 PM
allright it's much faster now with the possibility to set min profit for each draw.
I'm starting with 7 credit and a 15x payout

Code:
def martingale(current_bet, payout, profit):
    lost = 0
    x = 1
    while True:
        lost = lost + current_bet
        print "draw %s" %(x)
        print "lost %s" %lost
        while(((current_bet*payout-lost) + current_bet) < profit):
            current_bet = current_bet+1
        print "next bet : %s in order to win %s for a profit of %s" %(current_bet, current_bet*payout, current_bet*payout-lost)
        x = x + 1
        user_choice = raw_input("continue (c) / reset (r) : ")
        print "\n"
        if user_choice == "r":
            return

while True:
    print "================================================================"
    print "==================- dice martingale calculator -================"
    print "================================================================"
    current_bet = raw_input("initial_bet : ")
    payout = raw_input("payout : ")
    profit = raw_input("profit for each draw : ")
    martingale(int(current_bet), int(payout), int(profit))
    print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
    print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"