script_bustabit


SUBMITTED BY: thesco26

DATE: March 20, 2017, 2:37 a.m.

FORMAT: TypeScript

SIZE: 7.0 kB

HITS: 2036

  1. var baseBet = 10; // In bits
  2. var baseMultiplier = 1.33; // Target multiplier: 1.33 recommended
  3. var variableBase = false; // Enable variable mode (very experimental), read streakSecurity.
  4. 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+
  5. var maximumBet = 999999999; // Maximum bet the bot will do (in bits).
  6. // Pause settings
  7. var pauseThreshold = 20; // when game crashes above this, betting pauses
  8. var continueThreshold = 2; // when paused and the game crashes above this, betting resumes
  9. var pauseAfterNLosses = 3;
  10. var pauseForMGames = 7;
  11. /******************/
  12. pauseThreshold = Math.round(pauseThreshold * 100);
  13. continueThreshold = Math.round(continueThreshold * 100);
  14. // Variables - Do not touch!
  15. var baseSatoshi = baseBet * 100; // Calculated
  16. var currentBet = baseSatoshi;
  17. var currentMultiplier = baseMultiplier;
  18. var currentGameID = -1;
  19. var firstGame = true;
  20. var lossStreak = 0;
  21. var coolingDown = false;
  22. var lostLast = false;
  23. // Pause Variables
  24. var currentGameData;
  25. var lastCrash = (continueThreshold + pauseThreshold)/3;
  26. var paused = false;
  27. var pauseLossStreak = 0;
  28. var pausedFor = 0;
  29. // Initialization
  30. console.log('====== BustaBit Bot ======');
  31. console.log('My username is: ' + engine.getUsername());
  32. console.log('Starting balance: ' + (engine.getBalance() / 100).toFixed(3) + ' bits');
  33. var startingBalance = engine.getBalance();
  34. if (variableBase) {
  35. console.warn('[WARN] Variable mode is enabled and not fully tested. Bot is resillient to ' + streakSecurity + '-loss streaks.');
  36. }
  37. // On a game starting, place the bet.
  38. engine.on('game_starting', function(info) {
  39. console.log('====== New Game ======');
  40. /********************/
  41. if(lastCrash >= pauseThreshold) {
  42. paused = true;
  43. console.log("Pausing Betting");
  44. return;
  45. }
  46. if(paused) {
  47. if(lastCrash >= continueThreshold) {
  48. console.log("Continuing Betting");
  49. lastCrash = (continueThreshold + pauseThreshold)/3;
  50. paused = false;
  51. } else {
  52. console.log("Betting Is Paused");
  53. return;
  54. }
  55. }
  56. /********************/
  57. if(pausedFor > 0) {1
  58. pausedFor++;
  59. if(pausedFor <= pauseForMGames) {
  60. console.log("Paused " + pausedFor + " of " + pauseForMGames + " games");
  61. return;
  62. } else {
  63. console.log("Resuming");
  64. pausedFor = 0;
  65. pauseLossStreak = 0;
  66. }
  67. }
  68. if(pauseLossStreak >= pauseAfterNLosses) {
  69. console.log("Pausing for 1 of " + pauseForMGames + " games");
  70. pausedFor = 1;
  71. return;
  72. }
  73. /********************/
  74. console.log('[Bot] Game #' + info.game_id);
  75. currentGameID = info.game_id;
  76. if (coolingDown) {
  77. if (lossStreak == 0) {
  78. coolingDown = false;
  79. }
  80. else {
  81. lossStreak--;
  82. console.log('[Bot] Cooling down! Games remaining: ' + lossStreak);
  83. return;
  84. }
  85. }
  86. if (!firstGame) { // Display data only after first game played.
  87. console.log('[Stats] Session profit: ' + ((engine.getBalance() - startingBalance) / 100).toFixed(3) + ' bits');
  88. console.log('[Stats] Profit percentage: ' + (((engine.getBalance() / startingBalance) - 1) * 100).toFixed(3) + '%');
  89. }
  90. if (lostLast && !firstGame) {//if (engine.lastGamePlay() == 'LOST' && !firstGame) { // If last game loss:
  91. lossStreak++;
  92. var totalLosses = 0; // Total satoshi lost.
  93. var lastLoss = currentBet; // Store our last bet.
  94. while (lastLoss >= baseSatoshi) { // Until we get down to base bet, add the previous losses.
  95. totalLosses += lastLoss;
  96. lastLoss /= 3;
  97. }
  98. if (lossStreak > streakSecurity) { // If we're on a loss streak, wait a few games!
  99. coolingDown = true;
  100. return;
  101. }
  102. currentBet *= 3; // Then multiply base bet by 3!
  103. currentMultiplier = 1 + (totalLosses / currentBet);
  104. }
  105. else { // Otherwise if win or first game:
  106. lossStreak = 0; // If it was a win, we reset the lossStreak.
  107. if (variableBase) { // If variable bet enabled.
  108. // Variable mode resists (currently) 1 loss, by making sure you have enough to cover the base and the 3x base bet.
  109. var divider = 100;
  110. for (i = 0; i < streakSecurity; i++) {
  111. divider += (100 * Math.pow(3, (i + 1)));
  112. }
  113. newBaseBet = Math.min(Math.max(1, Math.floor(engine.getBalance() / divider)), maximumBet * 100); // In bits
  114. newBaseSatoshi = newBaseBet * 100;
  115. if ((newBaseBet != baseBet) || (newBaseBet == 1)) {
  116. console.log('[Bot] Variable mode has changed base bet to: ' + newBaseBet + ' bits');
  117. baseBet = newBaseBet;
  118. baseSatoshi = newBaseSatoshi;
  119. }
  120. }
  121. // Update bet.
  122. currentBet = baseSatoshi; // in Satoshi
  123. currentMultiplier = baseMultiplier;
  124. }
  125. // Message and set first game to false to be sure.
  126. console.log('[Bot] Betting ' + (currentBet / 100) + ' bits, cashing out at ' + currentMultiplier + 'x');
  127. firstGame = false;
  128. if (currentBet <= engine.getBalance()) { // Ensure we have enough to bet
  129. if (currentBet > (maximumBet * 100)) { // Ensure you only bet the maximum.
  130. console.warn('[Warn] Bet size exceeds maximum bet, lowering bet to ' + (maximumBet * 100) + ' bits');
  131. currentBet = maximumBet;
  132. }
  133. engine.placeBet(currentBet, Math.round(currentMultiplier * 100), false);
  134. }
  135. else { // Otherwise insufficent funds...
  136. if (engine.getBalance() < 100) {
  137. console.error('[Bot] Insufficent funds to do anything... stopping');
  138. engine.stop();
  139. }
  140. else {
  141. console.warn('[Bot] Insufficent funds to bet ' + (currentBet / 100) + ' bits.');
  142. console.warn('[Bot] Resetting to 1 bit basebet');
  143. baseBet = 1;
  144. baseSatoshi = 100;
  145. }
  146. }
  147. });
  148. engine.on('game_started', function(data) {
  149. if (!firstGame) { console.log('[Bot] Game #' + currentGameID + ' has started!'); }
  150. currentGameData = data;
  151. });
  152. engine.on('cashed_out', function(data) {
  153. if (data.username == engine.getUsername()) {
  154. console.log('[Bot] Successfully cashed out at ' + (data.stopped_at / 100) + 'x');
  155. }
  156. });
  157. engine.on('game_crash', function(data) {
  158. if (!firstGame) { console.log('[Bot] Game crashed at ' + (data.game_crash / 100) + 'x'); }
  159. /********************/
  160. lastCrash = data.game_crash;
  161. if (!currentGameData || !currentGameData.hasOwnProperty(engine.getUsername())) {
  162. return;
  163. };
  164. lostLast = engine.lastGamePlay() == 'LOST';
  165. console.log((lostLast ? "Lost" : "Won") + " this game.");
  166. /********************/
  167. if(!lostLast) {
  168. pauseLossStreak = 0;
  169. } else {
  170. pauseLossStreak++;
  171. }
  172. /********************/
  173. });

comments powered by Disqus