Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.00 KB | None | 0 0
  1. // Bustabit BlackShadow Cooldown Bot with Spiocha Pause
  2. // By: BlackShadow & MartinG
  3. // Version 3
  4.  
  5. /******************/
  6.  
  7.  
  8. // Settings
  9. var baseBet = 1444; // In bits
  10. var baseMultiplier = 1.14; // Target multiplier: 1.13 recommended
  11. var variableBase = false; // Enable variable mode (very experimental), read streakSecurity.
  12. var streakSecurity = 3; // Number of loss-streak you wanna be safe for. Increasing this massively reduces the variableBase calculated. (1-loss = 30%, 3-loss = 5%, 3-loss = 1.35% of your maximum balance). Recommended: 3+
  13. var maximumBet = 999999; // Maximum bet the bot will do (in bits).
  14.  
  15. // Pause settings
  16. var pauseThreshold = 50; // when game crashes above this, betting pauses
  17. var continueThreshold = 3.; // when paused and the game crashes above this, betting resumes
  18.  
  19. var pauseAfterNLosses = 2;
  20. var pauseForMGames = 66666666;
  21.  
  22. /******************/
  23.  
  24. pauseThreshold = Math.round(pauseThreshold * 100);
  25. continueThreshold = Math.round(continueThreshold * 100);
  26.  
  27. // Variables - Do not touch!
  28. var baseSatoshi = baseBet * 100; // Calculated
  29. var currentBet = baseSatoshi;
  30. var currentMultiplier = baseMultiplier;
  31. var currentGameID = -1;
  32. var firstGame = true;
  33. var lossStreak = 0;
  34. var coolingDown = false;
  35.  
  36. var lostLast = false;
  37.  
  38. // Pause Variables
  39. var currentGameData;
  40. var lastCrash = (continueThreshold + pauseThreshold)/3;
  41. var paused = false;
  42. var pauseLossStreak = 0;
  43. var pausedFor = 0;
  44.  
  45.  
  46. // Initialization
  47. console.log('====== Procon\'s BustaBit Bot with Pause ======');
  48. console.log('My username is: ' + engine.getUsername());
  49. console.log('Starting balance: ' + (engine.getBalance() / 100).toFixed(3) + ' bits');
  50. var startingBalance = engine.getBalance();
  51.  
  52. if (variableBase) {
  53. console.warn('[WARN] Variable mode is enabled and not fully tested. Bot is resillient to ' + streakSecurity + '-loss streaks.');
  54. }
  55.  
  56. // On a game starting, place the bet.
  57. engine.on('game_starting', function(info) {
  58.  
  59. console.log('====== New Game ======');
  60.  
  61. /********************/
  62.  
  63. if(lastCrash >= pauseThreshold) {
  64. paused = true;
  65. console.log("Pausing Betting");
  66. return;
  67. }
  68.  
  69. if(paused) {
  70. if(lastCrash >= continueThreshold) {
  71. console.log("Continuing Betting");
  72. lastCrash = (continueThreshold + pauseThreshold)/3;
  73. paused = false;
  74. } else {
  75. console.log("Betting Is Paused");
  76. return;
  77. }
  78. }
  79.  
  80. /********************/
  81.  
  82. if(pausedFor > 0) {
  83. pausedFor++;
  84. if(pausedFor <= pauseForMGames) {
  85. console.log("Paused " + pausedFor + " of " + pauseForMGames + " games");
  86. return;
  87. } else {
  88. console.log("Resuming");
  89. pausedFor = 0;
  90. pauseLossStreak = 0;
  91. }
  92. }
  93.  
  94. if(pauseLossStreak >= pauseAfterNLosses) {
  95. console.log("Pausing for 1 of " + pauseForMGames + " games");
  96. pausedFor = 1;
  97. return;
  98. }
  99.  
  100. /********************/
  101.  
  102.  
  103. console.log('[Bot] Game #' + info.game_id);
  104. currentGameID = info.game_id;
  105.  
  106. if (coolingDown) {
  107. if (lossStreak == 0) {
  108. coolingDown = false;
  109. }
  110. else {
  111. lossStreak--;
  112. console.log('[Bot] Cooling down! Games remaining: ' + lossStreak);
  113. return;
  114. }
  115. }
  116.  
  117. if (!firstGame) { // Display data only after first game played.
  118. console.log('[Stats] Session profit: ' + ((engine.getBalance() - startingBalance) / 100).toFixed(3) + ' bits');
  119. console.log('[Stats] Profit percentage: ' + (((engine.getBalance() / startingBalance) - 1) * 100).toFixed(3) + '%');
  120. }
  121.  
  122. if (lostLast && !firstGame) {//if (engine.lastGamePlay() == 'LOST' && !firstGame) { // If last game loss:
  123. lossStreak++;
  124. var totalLosses = 0; // Total satoshi lost.
  125. var lastLoss = currentBet; // Store our last bet.
  126. while (lastLoss >= baseSatoshi) { // Until we get down to base bet, add the previous losses.
  127. totalLosses += lastLoss;
  128. lastLoss /= 3;
  129. }
  130.  
  131. if (lossStreak > streakSecurity) { // If we're on a loss streak, wait a few games!
  132. coolingDown = true;
  133. return;
  134. }
  135.  
  136. currentBet *= 3; // Then multiply base bet by 3!
  137. currentMultiplier = 1 + (totalLosses / currentBet);
  138. }
  139. else { // Otherwise if win or first game:
  140. lossStreak = 0; // If it was a win, we reset the lossStreak.
  141. if (variableBase) { // If variable bet enabled.
  142. // Variable mode resists (currently) 1 loss, by making sure you have enough to cover the base and the 3x base bet.
  143. var divider = 100;
  144. for (i = 0; i < streakSecurity; i++) {
  145. divider += (100 * Math.pow(3, (i + 1)));
  146. }
  147.  
  148. newBaseBet = Math.min(Math.max(1, Math.floor(engine.getBalance() / divider)), maximumBet * 100); // In bits
  149. newBaseSatoshi = newBaseBet * 100;
  150.  
  151. if ((newBaseBet != baseBet) || (newBaseBet == 1)) {
  152. console.log('[Bot] Variable mode has changed base bet to: ' + newBaseBet + ' bits');
  153. baseBet = newBaseBet;
  154. baseSatoshi = newBaseSatoshi;
  155. }
  156. }
  157. // Update bet.
  158. currentBet = baseSatoshi; // in Satoshi
  159. currentMultiplier = baseMultiplier;
  160. }
  161.  
  162. // Message and set first game to false to be sure.
  163. console.log('[Bot] Betting ' + (currentBet / 100) + ' bits, cashing out at ' + currentMultiplier + 'x');
  164. firstGame = false;
  165.  
  166. if (currentBet <= engine.getBalance()) { // Ensure we have enough to bet
  167. if (currentBet > (maximumBet * 100)) { // Ensure you only bet the maximum.
  168. console.warn('[Warn] Bet size exceeds maximum bet, lowering bet to ' + (maximumBet * 100) + ' bits');
  169. currentBet = maximumBet;
  170. }
  171. engine.placeBet(currentBet, Math.round(currentMultiplier * 100), false);
  172. }
  173. else { // Otherwise insufficent funds...
  174. if (engine.getBalance() < 100) {
  175. console.error('[Bot] Insufficent funds to do anything... stopping');
  176. engine.stop();
  177. }
  178. else {
  179. console.warn('[Bot] Insufficent funds to bet ' + (currentBet / 100) + ' bits.');
  180. console.warn('[Bot] Resetting to 1 bit basebet');
  181. baseBet = 1;
  182. baseSatoshi = 100;
  183. }
  184. }
  185. });
  186.  
  187. engine.on('game_started', function(data) {
  188. if (!firstGame) { console.log('[Bot] Game #' + currentGameID + ' has started!'); }
  189. currentGameData = data;
  190. });
  191.  
  192. engine.on('cashed_out', function(data) {
  193. if (data.username == engine.getUsername()) {
  194. console.log('[Bot] Successfully cashed out at ' + (data.stopped_at / 100) + 'x');
  195. }
  196. });
  197.  
  198. engine.on('game_crash', function(data) {
  199. if (!firstGame) { console.log('[Bot] Game crashed at ' + (data.game_crash / 100) + 'x'); }
  200.  
  201. /********************/
  202.  
  203. lastCrash = data.game_crash;
  204.  
  205. if (!currentGameData || !currentGameData.hasOwnProperty(engine.getUsername())) {
  206. return;
  207. };
  208.  
  209. lostLast = engine.lastGamePlay() == 'LOST';
  210.  
  211. console.log((lostLast ? "Lost" : "Won") + " this game.");
  212.  
  213.  
  214. /********************/
  215.  
  216. if(!lostLast) {
  217. pauseLossStreak = 0;
  218. } else {
  219. pauseLossStreak++;
  220. }
  221.  
  222. /********************/
  223. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement