Bitcoin Forum
April 24, 2024, 08:41:27 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Quick and dirty python martingale calculator  (Read 840 times)
Eildosa (OP)
Member
**
Offline Offline

Activity: 572
Merit: 10


View Profile
August 03, 2015, 01:18:15 PM
Last edit: August 03, 2015, 02:48:07 PM by Eildosa
 #1

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 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

1713948087
Hero Member
*
Offline Offline

Posts: 1713948087

View Profile Personal Message (Offline)

Ignore
1713948087
Reply with quote  #2

1713948087
Report to moderator
"I'm sure that in 20 years there will either be very large transaction volume or no volume." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713948087
Hero Member
*
Offline Offline

Posts: 1713948087

View Profile Personal Message (Offline)

Ignore
1713948087
Reply with quote  #2

1713948087
Report to moderator
1713948087
Hero Member
*
Offline Offline

Posts: 1713948087

View Profile Personal Message (Offline)

Ignore
1713948087
Reply with quote  #2

1713948087
Report to moderator
LiQuidx
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500



View Profile
August 03, 2015, 01:53:02 PM
 #2

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. Smiley

 

██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████
 
Get Free Bitcoin Now!
  ¦¯¦¦¯¦    ¦¯¦¦¯¦    ¦¯¦¦¯¦    ¦¯¦¦¯¦   
0.8%-1% House Edge
[/
GiocareHost
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
August 03, 2015, 03:38:27 PM
 #3

But in the end its the luck rather than maths in gambling that matters.
Albeit I checked the script worked fine for me.
Dennis7777
Hero Member
*****
Offline Offline

Activity: 640
Merit: 500



View Profile
August 03, 2015, 03:46:09 PM
 #4

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 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.

anderson00673
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250



View Profile
August 03, 2015, 03:51:20 PM
 #5

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?
Eildosa (OP)
Member
**
Offline Offline

Activity: 572
Merit: 10


View Profile
August 03, 2015, 06:45:31 PM
 #6

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?

Eildosa (OP)
Member
**
Offline Offline

Activity: 572
Merit: 10


View Profile
August 03, 2015, 07:09:43 PM
Last edit: August 03, 2015, 07:27:53 PM by Eildosa
 #7

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"

Pages: [1]
  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!