script


SUBMITTED BY: elpelaosx19

DATE: June 17, 2019, 10:54 p.m.

FORMAT: Text only

SIZE: 5.0 kB

HITS: 34340

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

comments powered by Disqus