Advertisement
Guest User

Untitled

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