Esempio n. 1
0
    def __init__(self, *args, **kwargs):
        super(MyStrat, self).__init__(*args, **kwargs)
        self._bet = [1, 3, 7, 15, 32]
        self._curr_bet = 0

    def win(self):
        self._curr_bet = 0
        self.to_bet = self._bet[self._curr_bet]

    def lose(self):
        self._curr_bet = (self._curr_bet + 1) % len(self._bet)
        self.to_bet = self._bet[self._curr_bet]

def kaiousama(justdice):
    # Settings for this strategy.
    win_chance = Decimal('49.5')   # %
    to_bet =   Decimal('1')        # Starting BTC amount to bet.
    # Basic settings.
    bankroll = Decimal('500')      # BTC
    target = Decimal('1000')       # BTC
    getout =   Decimal('100')      # Stopping condition in BTC.
    # Other settings.
    strat_name = u'kaiousama'      # Strategy name.
    roll_high = True               # Roll high ?
    simulation = True # Only 0 BTC bets will be performed when this is True.
    #
    strat = MyStrat(justdice, locals())
    strat.run()

main(kaiousama)
Esempio n. 2
0

def strategy(justdice):

    strat_name = u"karma.coin"

    bankroll = Decimal("1")  # BTC
    win_chance = Decimal("65")  # %
    to_bet = Decimal("0.000001")  # Initial bet size (BTC)
    win_multiplier = Decimal("3")
    roll_high = False

    # Custom options for this strategy.
    max_losses_in_row = 4  # Reset to the initial bet.
    max_wins_in_row = 2  # Reset to the initial bet.
    num_rounds = 240
    max_bet_pct = Decimal("0.01")  # Bet at max 1% of the current bankroll.
    breaker_pattern = [False, True, False]  # Loss, Win, Loss
    breaker_bets = 4  # Number of bets to do after hitting the pattern above.
    breaker_bet_amount = Decimal("0.0001")  # BTC

    # Other settings.
    simulation = True  # Only 0 BTC bets will be performed when this is True.

    strat = MyStrategy(justdice, locals())
    strat.run()


if __name__ == "__main__":
    main(strategy, new_seed=True)
Esempio n. 3
0
#
# Browserless Bot for playing at just-dice.com
#
# This is an example for the standard Martingale strategy.
#
from decimal import Decimal

from browserless_player import main, run_strategy


def martingale(justdice):
    # Settings for this strategy.
    win_chance = Decimal('50')  # %
    to_bet =   Decimal('0.001') # Starting BTC amount to bet.
    lose_multiplier = Decimal('2') # Multiply bet by this amount on a lose.
    reset_on_win = True         # Reset to_bet to its original value on a win.
    # Basic settings.
    bankroll = Decimal('1.0')   # BTC
    target =   Decimal('1.6')   # Amount to reach in BTC.
    getout =   Decimal('0.1')   # Stopping condition in BTC.
    # Other settings.
    strat_name = u'Martingale'  # Strategy name.
    roll_high = True            # Roll high ?
    simulation = True # Only 0 BTC bets will be performed when this is True.
    #
    run_strategy(justdice, locals())

main(martingale)
Esempio n. 4
0
        if self.betting == 2:
            self.paper.append(self.to_bet)
        elif self.betting == 1:
            self.paper[-1] += self.to_bet
        # otherwise your bankroll is gone :/


def strategy(justdice):

    strat_name = u'Cancellation/Labouchere'

    win_chance = Decimal('49.5')  # 2x payout.
    bankroll = Decimal('1.0')  # BTC
    target = Decimal('2.0')  # BTC
    # Goal is to win x = (target - bankroll) bitcoins. For this example,
    # a unit will be x / num_units.
    num_units = 10
    to_bet = (target - bankroll) / num_units
    paper = [to_bet] * num_units

    # Other settings.
    roll_high = True
    simulation = True  # Only 0 BTC bets will be performed when this is True.

    strat = MyStrategy(justdice, locals())
    strat.run()


if __name__ == "__main__":
    main(strategy)
Esempio n. 5
0
    while to_bet < bankroll:
        n += 1
        print to_bet
        to_bet *= multiplier
    return n


#calc_tobet(Decimal('1.0'), Decimal('0.00001659'), Decimal('8.8219'))
#raise SystemExit


def dabs(justdice):
    # Settings for this strategy.
    win_chance = Decimal('87.7779')  # %
    bankroll = Decimal('1')  # BTC
    to_bet = Decimal('0.00001658') * bankroll  # Starting BTC amount to bet.
    lose_multiplier = Decimal(
        '8.8219')  # Multiply bet by this amount on a lose.
    reset_on_win = True  # Reset to_bet to its original value on a win.

    target = Decimal('2')  # Amount to reach in BTC.
    # Other settings.
    strat_name = u'Dabs'  # Strategy name.
    roll_high = True  # Roll high ?
    simulation = True  # Only 0 BTC bets will be performed when this is True.
    #
    run_strategy(justdice, locals())


main(dabs)
Esempio n. 6
0
        super(MyStrategy, self).win()
        self.consec_lose = 0

    def lose(self):
        super(MyStrategy, self).lose()
        self.consec_lose += 1
        if not self.consec_lose % self.double_after_n:
            self.to_bet *= 2

def syphen(justdice):
    # Settings for this strategy.
    win_chance = Decimal('16')  # %
    to_bet =   Decimal('0.01')  # Starting BTC amount to bet.
    reset_on_win = True         # Reset to_bet to its original value on a win.
    # Basic settings.
    bankroll = Decimal('1.0')   # BTC
    target =   Decimal('1.5')   # Amount to reach in BTC.
    getout =   Decimal('0.8')   # Stopping condition in BTC.
    # Other settings.
    strat_name = u'Syphen'      # Strategy name.
    roll_high = True            # Roll high ?
    simulation = True # Only 0 BTC bets will be performed when this is True.
    # Custom settings.
    double_after_n = 4  # Double bet after lossing n times.
    #

    strat = MyStrategy(justdice, locals())
    strat.run()

main(syphen)
Esempio n. 7
0
        data = urllib2.urlopen(ROLL % num).read()
        if data.lower().startswith('there is no'):
            # Nothing to see.
            return

        soup = BeautifulSoup(data)
        timestamp = soup.findAll('script')[2].text
        ts_where = timestamp.find('moment')
        timestamp = util.pretty_date(int(timestamp[ts_where+8:ts_where+18]))

        labels = soup.findAll(attrs={'class': 'slabel'})
        data = soup.findAll('span')
        userid = data[2].text.strip()
        win = 'won' if data[9].text.strip()[0] == 'w' else 'lost'
        gt = labels[7].text[-1]
        params = {'id': int(data[0].text.strip()), 'win': win,
                  'profit': data[5].text.strip(),
                  'lucky': data[8].text.strip(), 'gt': gt,
                  'target': data[7].text.strip(), 'user': userid,
                  'ago': timestamp}
        print 'show bet %d' % int(num)
        self.sock.emit('chat', self.csrf, (text % params).encode('utf8'))


def bot(justdice):
    while True:
        time.sleep(0.05)

if __name__ == "__main__":
    main(bot, new_seed=False, justdice=ChatSocket)
Esempio n. 8
0
from decimal import Decimal

from browserless_player import main, roll_dice

def play(justdice):
    # XXX Define your strategy here.
    win = 0     # Win count.
    nroll = 40  # Roll n times.

    amount = Decimal('0')     # Amount in BTC to bet.
    roll_hi = False
    win_chance = Decimal('2') # %.

    for _ in xrange(nroll):
        if roll_dice(justdice, win_chance, amount, roll_hi):
            win += 1

    return win, nroll


if __name__ == "__main__":
    if len(sys.argv) < 3:
        print "WARNING user and password were not specified."
        print "Expected usage: %s user password [-dummy]" % sys.argv[0]
        print "***" * 15

    dummy = False
    if len(sys.argv) == 4 and sys.argv[3].startswith('-d'):
        dummy = True
    main(play, *sys.argv[1:3], dummy=dummy)
Esempio n. 9
0
#
# Browserless Bot for playing at just-dice.com
#
# Create your own strategy by redifining the "play" function.
#

import sys
from decimal import Decimal

from browserless_player import main, roll_dice

def play(justdice):
    # XXX Define your strategy here.
    win = 0     # Win count.
    nroll = 40  # Roll n times.

    amount = Decimal('0')     # Amount in BTC to bet.
    roll_hi = False
    win_chance = Decimal('2') # %.

    for _ in xrange(nroll):
        if roll_dice(justdice, win_chance, amount, roll_hi, True)[0]:
            win += 1

    sys.stderr.write("\nWin ratio: %d/%d = %s\n" % (
        win, nroll, Decimal(win) / nroll if nroll else 0))


if __name__ == "__main__":
    main(play)
Esempio n. 10
0
# Browserless Bot for playing at just-dice.com
#
# Create your own strategy by redifining the "play" function.
#

import sys
from decimal import Decimal

from browserless_player import main, roll_dice


def play(justdice):
    # XXX Define your strategy here.
    win = 0  # Win count.
    nroll = 40  # Roll n times.

    amount = Decimal('0')  # Amount in BTC to bet.
    roll_hi = False
    win_chance = Decimal('2')  # %.

    for _ in xrange(nroll):
        if roll_dice(justdice, win_chance, amount, roll_hi, True)[0]:
            win += 1

    sys.stderr.write("\nWin ratio: %d/%d = %s\n" %
                     (win, nroll, Decimal(win) / nroll if nroll else 0))


if __name__ == "__main__":
    main(play)
Esempio n. 11
0
        if self.betting == 2:
            self.paper.append(self.to_bet)
        elif self.betting == 1:
            self.paper[-1] += self.to_bet
        # otherwise your bankroll is gone :/


def strategy(justdice):

    strat_name = u'Cancellation/Labouchere'

    win_chance = Decimal('49.5')# 2x payout.
    bankroll = Decimal('1.0')   # BTC
    target = Decimal('2.0')     # BTC
    # Goal is to win x = (target - bankroll) bitcoins. For this example,
    # a unit will be x / num_units.
    num_units = 10
    to_bet = (target - bankroll) / num_units
    paper = [to_bet] * num_units

    # Other settings.
    roll_high = True
    simulation = True # Only 0 BTC bets will be performed when this is True.

    strat = MyStrategy(justdice, locals())
    strat.run()


if __name__ == "__main__":
    main(strategy)
Esempio n. 12
0
    max_losses_in_row = 4  # Reset to the initial bet.
    max_wins_in_row = 2  # Reset to the initial bet.
    num_rounds = 24
    max_bet_pct = Decimal('0.8')  # Bet at max 80% of the current bankroll.

    breaker_pattern = {
        (False, True, False, True): {
            'bets': 7,
            'amount': Decimal('0.000075'),
            # Activate this pattern only if in the last n bets (100 above)
            # there were at max max_loss_ratio * n losses.
            'max_loss_ratio': Decimal('0.2')
        },
        (False, False): {
            'bets': 5,
            'amount': Decimal('0'),
            # max_loss_ratio is not used for this pattern.
            'max_loss_ratio': Decimal('1.1')
        }
    }

    # Other settings.
    simulation = True  # Only 0 BTC bets will be performed when this is True.

    strat = MyStrategy(justdice, locals())
    strat.run()


if __name__ == "__main__":
    main(strategy, new_seed=True)
Esempio n. 13
0
from browserless_player import main, run_strategy

def calc_tobet(bankroll, to_bet, multiplier):
    n = 0
    while to_bet < bankroll:
        n += 1
        print to_bet
        to_bet *= multiplier
    return n

#calc_tobet(Decimal('1.0'), Decimal('0.00001659'), Decimal('8.8219'))
#raise SystemExit

def dabs(justdice):
    # Settings for this strategy.
    win_chance = Decimal('87.7779')             # %
    bankroll = Decimal('1')                     # BTC
    to_bet =   Decimal('0.00001658') * bankroll # Starting BTC amount to bet.
    lose_multiplier = Decimal('8.8219') # Multiply bet by this amount on a lose.
    reset_on_win = True         # Reset to_bet to its original value on a win.

    target =   Decimal('2')     # Amount to reach in BTC.
    # Other settings.
    strat_name = u'Dabs'  # Strategy name.
    roll_high = True      # Roll high ?
    simulation = True # Only 0 BTC bets will be performed when this is True.
    #
    run_strategy(justdice, locals())

main(dabs)
Esempio n. 14
0
        ts_where = timestamp.find('moment')
        timestamp = util.pretty_date(int(timestamp[ts_where + 8:ts_where +
                                                   18]))

        labels = soup.findAll(attrs={'class': 'slabel'})
        data = soup.findAll('span')
        userid = data[2].text.strip()
        win = 'won' if data[9].text.strip()[0] == 'w' else 'lost'
        gt = labels[7].text[-1]
        params = {
            'id': int(data[0].text.strip()),
            'win': win,
            'profit': data[5].text.strip(),
            'lucky': data[8].text.strip(),
            'gt': gt,
            'target': data[7].text.strip(),
            'user': userid,
            'ago': timestamp
        }
        print 'show bet %d' % int(num)
        self.sock.emit('chat', self.csrf, (text % params).encode('utf8'))


def bot(justdice):
    while True:
        time.sleep(0.05)


if __name__ == "__main__":
    main(bot, new_seed=False, justdice=ChatSocket)