SHOW:
|
|
- or go back to the newest paste.
1 | // Settings | |
2 | var baseBet = 10; // In bits | |
3 | var baseMultiplier = 1.10; // Target multiplier: 1.13 recommended | |
4 | var variableBase = true; // Enable variable mode (very experimental), read streakSecurity. | |
5 | var streakSecurity = 4; // Number of loss-streak you wanna be safe for. Increasing this massively reduces the variableBase calculated. (1-loss = 20%, 2-loss = 5%, 3-loss = 1.25% of your maximum balance). Recommended: 2+ | |
6 | var maximumBet = 999999; // Maximum bet the bot will do (in bits). | |
7 | ||
8 | // Variables - Do not touch! | |
9 | var baseSatoshi = baseBet * 100; // Calculated | |
10 | var currentBet = baseSatoshi; | |
11 | var currentMultiplier = baseMultiplier; | |
12 | var currentGameID = -1; | |
13 | var firstGame = true; | |
14 | var lossStreak = 0; | |
15 | var coolingDown = false; | |
16 | ||
17 | // Initialization | |
18 | console.log('====== Procon\'s BustaBit Bot ======'); | |
19 | console.log('My username is: ' + engine.getUsername()); | |
20 | console.log('Starting balance: ' + (engine.getBalance() / 100).toFixed(2) + ' bits'); | |
21 | var startingBalance = engine.getBalance(); | |
22 | ||
23 | if (variableBase) { | |
24 | console.warn('[WARN] Variable mode is enabled and not fully tested. Bot is resillient to ' + streakSecurity + '-loss streaks.'); | |
25 | } | |
26 | ||
27 | // On a game starting, place the bet. | |
28 | engine.on('game_starting', function(info) { | |
29 | console.log('====== New Game ======'); | |
30 | console.log('[Bot] Game #' + info.game_id); | |
31 | currentGameID = info.game_id; | |
32 | ||
33 | if (coolingDown) { | |
34 | if (lossStreak == 0) { | |
35 | coolingDown = false; | |
36 | } | |
37 | else { | |
38 | lossStreak--; | |
39 | console.log('[Bot] Cooling down! Games remaining: ' + lossStreak); | |
40 | return; | |
41 | } | |
42 | } | |
43 | ||
44 | if (!firstGame) { // Display data only after first game played. | |
45 | console.log('[Stats] Session profit: ' + ((engine.getBalance() - startingBalance) / 100).toFixed(2) + ' bits'); | |
46 | console.log('[Stats] Profit percentage: ' + (((engine.getBalance() / startingBalance) - 1) * 100).toFixed(2) + '%'); | |
47 | } | |
48 | ||
49 | if (engine.lastGamePlay() == 'LOST' && !firstGame) { // If last game loss: | |
50 | lossStreak++; | |
51 | var totalLosses = 0; // Total satoshi lost. | |
52 | var lastLoss = currentBet; // Store our last bet. | |
53 | while (lastLoss >= baseSatoshi) { // Until we get down to base bet, add the previous losses. | |
54 | totalLosses += lastLoss; | |
55 | lastLoss /= 4; | |
56 | } | |
57 | ||
58 | if (lossStreak > streakSecurity) { // If we're on a loss streak, wait a few games! | |
59 | coolingDown = true; | |
60 | return; | |
61 | } | |
62 | ||
63 | currentBet *= 4; // Then multiply base bet by 4! | |
64 | currentMultiplier = 1 + (totalLosses / currentBet); | |
65 | } | |
66 | else { // Otherwise if win or first game: | |
67 | lossStreak = 0; // If it was a win, we reset the lossStreak. | |
68 | if (variableBase) { // If variable bet enabled. | |
69 | // Variable mode resists (currently) 1 loss, by making sure you have enough to cover the base and the 4x base bet. | |
70 | var divider = 100; | |
71 | for (i = 0; i < streakSecurity; i++) { | |
72 | divider += (100 * Math.pow(4, (i + 1))); | |
73 | } | |
74 | ||
75 | newBaseBet = Math.min(Math.max(1, Math.floor(engine.getBalance() / divider)), maximumBet * 100); // In bits | |
76 | newBaseSatoshi = newBaseBet * 100; | |
77 | ||
78 | if ((newBaseBet != baseBet) || (newBaseBet == 1)) { | |
79 | console.log('[Bot] Variable mode has changed base bet to: ' + newBaseBet + ' bits'); | |
80 | baseBet = newBaseBet; | |
81 | baseSatoshi = newBaseSatoshi; | |
82 | } | |
83 | } | |
84 | // Update bet. | |
85 | currentBet = baseSatoshi; // in Satoshi | |
86 | currentMultiplier = baseMultiplier; | |
87 | } | |
88 | ||
89 | // Message and set first game to false to be sure. | |
90 | console.log('[Bot] Betting ' + (currentBet / 100) + ' bits, cashing out at ' + currentMultiplier + 'x'); | |
91 | firstGame = false; | |
92 | ||
93 | if (currentBet <= engine.getBalance()) { // Ensure we have enough to bet | |
94 | if (currentBet > (maximumBet * 100)) { // Ensure you only bet the maximum. | |
95 | console.warn('[Warn] Bet size exceeds maximum bet, lowering bet to ' + (maximumBet * 100) + ' bits'); | |
96 | currentBet = maximumBet; | |
97 | } | |
98 | engine.placeBet(currentBet, Math.round(currentMultiplier * 100), false); | |
99 | } | |
100 | else { // Otherwise insufficent funds... | |
101 | if (engine.getBalance() < 100) { | |
102 | console.error('[Bot] Insufficent funds to do anything... stopping'); | |
103 | engine.stop(); | |
104 | } | |
105 | else { | |
106 | console.warn('[Bot] Insufficent funds to bet ' + (currentBet / 100) + ' bits.'); | |
107 | console.warn('[Bot] Resetting to 1 bit basebet'); | |
108 | baseBet = 1; | |
109 | baseSatoshi = 100; | |
110 | } | |
111 | } | |
112 | }); | |
113 | ||
114 | engine.on('game_started', function(data) { | |
115 | if (!firstGame) { console.log('[Bot] Game #' + currentGameID + ' has started!'); } | |
116 | }); | |
117 | ||
118 | engine.on('cashed_out', function(data) { | |
119 | if (data.username == engine.getUsername()) { | |
120 | console.log('[Bot] Successfully cashed out at ' + (data.stopped_at / 100) + 'x'); | |
121 | } | |
122 | }); | |
123 | ||
124 | engine.on('game_crash', function(data) { | |
125 | if (!firstGame) { console.log('[Bot] Game crashed at ' + (data.game_crash / 100) + 'x'); } | |
126 | }); |