Bustadice Script powerful


SUBMITTED BY: geebar777

DATE: Feb. 20, 2021, 2:53 a.m.

FORMAT: Text only

SIZE: 7.3 kB

HITS: 403

  1. Bustadice.com
  2. Player: 777Gee
  3. /******** SETTINGS ********/
  4. const BASE_WAGER = 100; // Initial lowest possible bet to start with. (Satoshis)
  5. const BASE_TARGET = 200; // Target payout to chase for. (Actual payout format 2.00x = 2.00)
  6. const AUTO_MULTIPLE = false; // Auto calculate and override BET_MULTIPLE for BASE_TARGET.
  7. const BET_MULTIPLE = 1.005; // Multiply bet by this value (1 = no increase) after each loss.
  8. const BET_INCREASE = 0.1; // Increase bet by this flat amount after each loss. (Satoshis)
  9. const TAR_MULTIPLE = 1; // Multiply target by this value (1 = no increase) on each loss.
  10. const TAR_INCREASE = 0; // Increase target by this flat amount after each loss.
  11. const MAX_WAGER = 5000 // Prevents script from placing bets larger than this amount.(Bits)
  12. const STOP_ON_MAX = true; // Stop The script when MAX_WAGER is reached.
  13. const RESET_ON_MAX = true; // Returns to BASE_BET when MAX_WAGER is reached,
  14. const MAX_TARGET = 300; // Prevents the script from betting past this target payout.
  15. const STOP_MAX_TARG = true; // Stop the script when MAX_TARGET is reached.
  16. const RESET_MAX_TARG = true; // Returns to BASE_TARGET when MAX_TARGET is reached.
  17. const STOP_ON_HIT = false; // Stop the script after hitting target payout.
  18. const RESET_ON_HIT = true; // Returns to base bet after hitting target payout.
  19. const STOP_TRAIL = 8000 // Stop if current streak losses exceed this amount (Bits) or -1 to disable.
  20. const STOP_PROFIT = 30000; // Stop the script when profits reach this amount. (Bits) or -1 to disable.
  21. const STOP_BALANCE = 5000; // Stop if next bet would reduce balance below this amount. (Bits) or -1 to disable.
  22. const QUEUE_MODE = 0; // Sets queue mode ( 0 = Auto Latency Based / 1 = Manual Set QUEUE_SIZE )
  23. const QUEUE_SIZE = 100; // Adjusts bet concurrency. Keep it below 200. Don't be a hero..
  24. /****** ADV SETTINGS ******/
  25. const DEBUG_OUTPUT = true; // Output log to the script log box on the site.
  26. const DEBUG_CONSOLE = false; // Output log to the browser developer console / toolbox
  27. const DEBUG_MODE = false; // Runs script like normal except bets are replaced by skips (no bets)
  28. const DEBUG_TEST = false; // Tests speed/latency and stops script without betting.
  29. /**************************/
  30. let betCount = 0;
  31. let totalOut = 0;
  32. let totalIn = 0;
  33. let queueSize = null
  34. let ourProfits = 0;
  35. let prevProfits = 0;
  36. let queue = null
  37. let running = true;
  38. const cl = console.log
  39. const ol = this.log
  40. console.log = function () {
  41. if (DEBUG_CONSOLE) { cl.apply(this, arguments); }
  42. if (DEBUG_OUTPUT) { ol.apply(this, arguments); }
  43. }
  44. const getMultiple = function (target) {
  45. ((`${target}`).includes('.') || target < 100) ? target = Math.round(target * 100): null;
  46. const d = (`${target}`).length - 1;
  47. return (((Math.ceil((1 / (1 - (Math.ceil(((100 / 101) * (99 / (((target * 1) / 100) * 100 - 1))) * (Math.pow(10, d)))) / (Math.pow(10, d)))) * (Math.pow(100, (d - 1)))) / (Math.pow(100, (d - 1)))).toFixed(d)) / 1)
  48. }
  49. const betMultiple = AUTO_MULTIPLE ? getMultiple(`${BASE_TARGET*100}`) : BET_MULTIPLE;
  50. console.log(`Bet multiple for ${BASE_TARGET}x is ${betMultiple} * wager on loss.`)
  51. const getWager = function () {
  52. let wager = Math.round(((BASE_WAGER * Math.pow(betMultiple, totalOut)) + (BET_INCREASE * totalOut)) / 100) * 100;
  53. if (wager >= (MAX_WAGER * 100)) {
  54. if (STOP_ON_MAX) {
  55. console.log(`Stopping due to MAX_WAGER exceeded! (${wager / 100} bits)`)
  56. running = false;
  57. } else if (RESET_ON_MAX) {
  58. totalOut = 0;
  59. //return getWager();
  60. }
  61. }
  62. let target = (BASE_TARGET * (TAR_MULTIPLE ** totalOut)) + (TAR_INCREASE * totalOut);
  63. if (target >= MAX_TARGET) {
  64. if (STOP_MAX_TARG) {
  65. console.log(`Stopping due to MAX_TARGET exceeded! (${target}x)`)
  66. running = false;
  67. } else if (RESET_MAX_TARG) {
  68. totalOut = 0;
  69. //return getWager();
  70. }
  71. }
  72. return ({ value: wager, target: target });
  73. }
  74. const roundBit = function (bet) {
  75. return Math.max(100, Math.round(bet / 100) * 100);
  76. }
  77. const doResult = async function (context, result) {
  78. totalIn++;
  79. if (!DEBUG_MODE) {
  80. if (result.multiplier < result.target) {
  81. ourProfits -= result.value;
  82. if(STOP_TRAIL > 0 && prevProfits - ourProfits > (STOP_TRAIL * 100)){
  83. console.log(`Stopping after hitting trailing stop at ${ourProfits / 100} bits profit retained!`)
  84. running = false;
  85. }
  86. } else {
  87. let profit = (result.value * result.target) - result.value
  88. ourProfits += profit
  89. if(ourProfits >= prevProfits){
  90. prevProfits = ourProfits;
  91. }
  92. console.log(`Won. Profits at ${ourProfits/100}, next bet ${result.value/100} bits @ ${result.target}x`);
  93. if (STOP_ON_HIT) {
  94. console.log(`Stopping after hitting target`)
  95. running = false;
  96. } else if (STOP_PROFIT > 0 && (ourProfits / 100) >= STOP_PROFIT) {
  97. console.log(`Stopping after reaching ${ourProfits / 100} bits profits`)
  98. running = false;
  99. }
  100. if (RESET_ON_HIT) {
  101. totalOut = 0;
  102. }
  103. }
  104. console.log(`Current Chase Bets IN/OUT ${totalIn}/${totalOut} | Total Bets ${betCount}`);
  105. }
  106. }
  107. const main = async function (context) {
  108. const startTime = Date.now()
  109. while (running) {
  110. const cycleStart = Date.now();
  111. let bet = null
  112. let bal = context.balance;
  113. for (let i = 0; i < queueSize; i++) {
  114. bet = getWager(totalOut);
  115. bal -= bet.value;
  116. if (STOP_BALANCE > 0 && (bal / 100) < STOP_BALANCE) {
  117. running = false;
  118. console.log(`Stopping before STOP_BALANCE with ${bet.value / 100} bits wager!`);
  119. break;
  120. }
  121. if (running) {
  122. queue[i] = (DEBUG_MODE ? context.skip() : context.bet(roundBit(bet.value), bet.target));
  123. betCount++;
  124. totalOut++;
  125. console.log(`Inserted bet into queue slot [${bet.value/100}bits @ ${bet.target}x] Bet ID ${totalOut}`);
  126. } else {
  127. break;
  128. }
  129. }
  130. const genTime = Date.now();
  131. if (running) {
  132. await Promise.all(queue.map(p => p.catch(e => e))).then(async (results) => { await results.forEach(result => doResult(context, result)) });
  133. await sleep(queueSize);
  134. }
  135. const cycleEnd = Date.now();
  136. console.log(`Cycle efficiency at ${(queueSize / (genTime - startTime)) * 1000} + ${(queueSize / (cycleEnd - genTime)) * 1000} bets per second.`)
  137. }
  138. const endTime = Date.now();
  139. console.log(`Total script runtime ${(endTime - startTime) / 60000} minutes.`)
  140. }
  141. function sleep(ms) {
  142. return new Promise(resolve => setTimeout(resolve, ms));
  143. }
  144. const getLatency = async function (context, count = 10, size = 5) {
  145. let results = [];
  146. while (results.length < count) {
  147. let t0 = performance.now();
  148. for (let t = 0; t < size; t++) {
  149. await context.skip();
  150. }
  151. let t1 = performance.now();
  152. results.push((t1 - t0) / 5);
  153. }
  154. let t1 = performance.now();
  155. context.skip();
  156. let t2 = performance.now();
  157. return (results.reduce((a, b) => a + b, 0) / count) - ((t2 - t1) * count);
  158. }
  159. if (DEBUG_TEST) {
  160. let latency = await getLatency(this);
  161. this.log(`Measured latency at ${latency} ms`)
  162. } else {
  163. if (QUEUE_MODE === 0) {
  164. this.log(`Calculating queue size..`)
  165. queueSize = Math.round(await getLatency(this));
  166. } else {
  167. queueSize = Math.round(QUEUE_SIZE);
  168. }
  169. queue = new Array(queueSize);
  170. this.log(`Starting script at ${queueSize} queue size`)
  171. await main(this);
  172. }

comments powered by Disqus