View difference between Paste ID: KJYYFV5W and kRfmhb99
SHOW: | | - or go back to the newest paste.
1
//////////////////////////////////
2
// MartinG's Martingale
3
// v 1.0.3
4
/*////////////////////////////////
5
6
MartinG's Martingale, is just a classic martingale strategy that makes it 
7
really easy to configure.
8
9
Just tell it what streak protection you want (maxLossStreakPerRound) and how 
10
much you can afford to loose if there is a streak (costOfLoosingRound).
11
 
12
Also you can set the desired cashout.
13
14
There is no need to calculate the base bet or multiplier.
15
16
NOTE: Base Bet will be printed in console. If your base bet is less than 1 bit, 
17
that probably means your costOfLoosingRound is too low or your 
18
maxLossStreakPerRound is too high.
19
20
*//////////////////////////////////
21
22
var cashout = 1.35;
23
var maxLossStreakPerRound = 3;
24
var costOfLoosingRound = 500;
25
26
/////////////////////////////////
27
// No need to change anything below this line
28
/////////////////////////////////
29
30
var baseBet = 1;
31
32
var p = baseBet * (cashout - 1);
33
34
var losses = 0;
35
var lostBits = 0;
36
var nextBet = baseBet;
37
38
function loose(_lostBits, _nextBet, _losses) {
39
40
		if(_losses >= maxLossStreakPerRound) {
41
42
			return _lostBits;
43
44
		} else {
45
			
46
			_lostBits = _lostBits + _nextBet + p;	
47
			_nextBet = (_lostBits + p) / (cashout - 1);
48
			return loose(_lostBits, _nextBet, _losses + 1);
49
50
		}
51
52
}
53
54
baseBet = costOfLoosingRound/loose(0,baseBet,0);
55
p = baseBet * (cashout - 1);
56
nextBet = baseBet;
57
58
console.log("Base Bet: " + baseBet);
59
60
var playing = false;
61
62
engine.on('game_starting', function(info) {
63
64
	engine.placeBet(Math.floor(nextBet)*100, Math.round(cashout * 100));
65
	playing = true;
66
67
});
68
69
engine.on('game_crash', function(data) {
70
71
	if(!playing) {
72
		return;	
73
	}
74
  
75
	playing = false;
76
77
	if(engine.lastGamePlay() == 'LOST') {
78
79
		losses = losses + 1;
80
		lostBits = lostBits + nextBet + p;
81
		
82
		if(losses >= maxLossStreakPerRound) {
83
84
			losses = 0;
85
			lostBits = 0;	
86
			nextBet = baseBet;
87
88
		} else {
89
				
90
			nextBet = (lostBits + p) / (cashout - 1);
91
92
		}
93
94
	} else {
95
96
		losses = 0;	
97
		lostBits = 0;
98
		nextBet = baseBet;
99
100
	}
101
102
});