Advertisement
NovaHQ

Untitled

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