Advertisement
Guest User

FORTHEBOYSTODAY

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