-
Notifications
You must be signed in to change notification settings - Fork 5
/
run.py
86 lines (69 loc) · 2.71 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
''' LICENCE
This file is part of primeDiceBot.
primeDiceBot is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
primeDiceBot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Nome-Programma. If not, see <http://www.gnu.org/licenses/>.
'''
import primeDiceClass as primedice
import config
import sys
import time
print "Script is starting, please wait!"
helpme = primedice.helpers()
helpme.config_check(config)
user = primedice.primedice()
# user.login(config.username, config.password)
user.login(config.token)
# Set the "fairness" random seed
user.set_seed()
bet_size = config.base_bet
probability = config.win_chance
print "Game is starting!"
while (user.bet_count < config.max_bet_number) \
or (user.balance >= config.min_balance)\
or (user.balance <= config.max_balance)\
or (bet_size <= maximum_bet):
if bet_size > user.balance:
print("Insufficient funds! :( Returning to base bet & probability")
bet_size = config.base_bet
probability = config.win_chance
if bet_size > user.balance:
print "You have only %s coin" % user.balance
print "While the base bet is %s" % bet_size
sys.exit("Impossible to continue. Base bet is more then the current balance")
time.sleep(config.wait_time)
user.bet_count += 1
print "[%s] Betting %s, %s" % (user.bet_count, bet_size, probability),
bet_feedback = user.bet(bet_size, probability, "<")
if bet_feedback["win"]:
print "WON,\tbalance = %s" % (user.balance)
bet_size *= config.after_win_multiplier
if not bet_size:
bet_size = config.base_bet
bet_size += config.after_win_sum
if config.after_win_prob_reset:
probability = config.win_chance
else:
probability += config.after_win_prob_sum
else:
print "LOST,\tbalance = %s" % (user.balance)
bet_size *= config.after_loss_multiplier
if not bet_size:
bet_size = user.base_bet
bet_size += config.after_loss_sum
if config.after_loss_prob_reset:
probability = config.win_chance
else:
probability += config.after_loss_prob_sum
if probability > 98:
probability = 98
if probability < 0.01:
probability = 0.01
print "I stopped playing"