Bustabit Script


SUBMITTED BY: theophilus3704477

DATE: April 4, 2016, 10:17 a.m.

FORMAT: Text only

SIZE: 4.6 kB

HITS: 801

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

comments powered by Disqus