Advertisement
Guest User

Untitled

a guest
Jan 10th, 2019
1,301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.77 KB | None | 0 0
  1. var RISK_FACTOR = 1.7 /* Overall change for all situations to happen. Set to 0.0 to run without STW, set 1.0 to run with safety feature */
  2. var RISK_MULTIPLIER = 0.01 /* Overall change for all bets size after lose bet */
  3. var RISK_BASE = 1 /* Overall change for all targets base bet by multiple it, for now all targets starting with basebet = 1 */
  4.  
  5. var minProfit = -15000 /* max lose before stop: -2061773 -4072030 */
  6. var maxProfit = 3000 /* max profit before stop */
  7.  
  8. var change_seed_next_STW = 30000
  9. var change_seed_next_noSTW = 5000
  10.  
  11. var setup = 7 /* Preset selector */
  12. /**
  13. * 1 - Create randomized targets, with random bets, turns, stws
  14. * 2 - Segmentar for 9.44 with 8 max turns and 8 stw and high various Math.pow
  15. * 3 - Segmentar for 9.44 with 8 max turns and 8 stw
  16. * 4 - Segmentar for 9.44 with return to base
  17. * 5 - Segmentar for 9.44 with memory, insanity risk for crazy profit
  18. * 6 - Many high targets
  19. * 7 - 4.72x 9.09x 15x 30x 60x 19x 25x 9.44x 50x 12x 8.4x 5.4x with limited max turns and turned ON memory
  20. * 8 - 4.72x 9.09x 15x 30x 60x 19x 25x 9.44x 50x 12x 8.4x 5.4x
  21. * 9 - Single 5x play
  22. * 10 - Segmentar 9.44x, Math.pow 2.72 and configurated OP
  23. * 11 - 9.44x 15x 25x with max turns and semi-memoryzed targets
  24. * 12 - Testing OP(20k required)
  25. * 13 - Super-OP with incredible multiplier for second target and high bet size for both (1 BTC required)
  26. * 14 - soft-OP 2 targets of 9.44, high multiplier for second target
  27. * 15 - soft-OP 4 targets of 9.44 and various multipliers from low to high
  28. * 16 - soft-OP Math.pow 2.4 6 targets of 9.44
  29. * 17 - 3 targets playing, normal mode
  30. * 18 - [2.36x, 4.72x 9.44x safety] [250.000 bits bankroll]
  31. * 19 - [2.36x, 4.72x 9.44x 15x 30x 60x safety] [2 BTC bankroll]
  32. * 20 - [2.36x, 4.72x 9.44x 15x 30x 60x safety] [4 BTC bankroll]
  33. * 21 - [5x plays in 3 ranges]
  34. */
  35.  
  36. var HIT_MIN_PROFIT_TIMES = 1 /* Moving stop, after reach minProfit X times it will reset script, 0 to disable */
  37. var HIT_MAX_PROFIT_TIMES = 12 /* Moving profit reacher, when hit maxProfit, do reset profit, so you don't risk it, 0 to disable */
  38.  
  39. const LONGEST_DIFFCULTY = 14 /* STW calculated based on this formula */
  40. const PLAY_IN_RANGE = 4 /* Seed numbers has 4 distances, early, mid, late, extra late */
  41.  
  42. var ex = { /* Global settings to game */ /*(990000 / ( 100 * (multiplier + 0.01) * 100 - 1))*/
  43. mul_target: 1.0,
  44. reset_all_after_win: false, /* Reset all memory bets to base bets after one of targets has won */
  45. increase_STW_by_same_targets: false, /* Increases STW by one with same target and STW amount */
  46. reset_STW_after_game_pass: true,
  47. disable_target_at_bust: false, /* Make current playing target at bust go offline till it ressurect's */
  48. increasing_bets_at_peak: false,
  49. bankroll_settings: false, /* Use bankroll size determinated by user balance, needed for run 250k 2btc and 4btc */
  50. advanced_log: false,
  51. game_sounds: true,
  52. calculate_base: false, /* TODO, feature for auto calculate safety bet size based on your balance and choose STW for each multi */
  53. interval_rolls: 0, /* Pause between rolls */
  54. nyan_hunting: {
  55. enabled: true,
  56. sessionProfit: 500000, /* Amount in bits to risk while chase high multipliers */
  57. sessionBet: 1000, /* Amount to bet while chasing high multipliers */
  58. sessionTarget: 1000, /* Target and higher session profit being to be applied */
  59. },
  60. hard_style: {
  61. enabled: false,
  62. max_loss: -25000,
  63. multiplier: 0.08,
  64. streak_range: 2,
  65. },
  66. fast_betting: {
  67. enabled: false,
  68. chase: 1.01,
  69. multiplier: 1.01,
  70. }
  71. }
  72.  
  73. var arr = {
  74. max: function(array) {
  75. return Math.max.apply(null, array);
  76. },
  77.  
  78. min: function(array) {
  79. return Math.min.apply(null, array);
  80. },
  81.  
  82. range: function(array) {
  83. return arr.max(array) - arr.min(array);
  84. },
  85.  
  86. midrange: function(array) {
  87. return arr.range(array) / 2;
  88. },
  89.  
  90. sum: function(array) {
  91. var num = 0;
  92. for (var i = 0, l = array.length; i < l; i++) num += array[i];
  93. return num;
  94. },
  95.  
  96. mean: function(array) {
  97. return arr.sum(array) / array.length;
  98. },
  99.  
  100. median: function(array) {
  101. array.sort(function(a, b) {
  102. return a - b;
  103. });
  104. var mid = array.length / 2;
  105. return mid % 1 ? array[mid - 0.5] : (array[mid - 1] + array[mid]) / 2;
  106. },
  107.  
  108. modes: function(array) {
  109. if (!array.length) return [];
  110. var modeMap = {},
  111. maxCount = 1,
  112. modes = [array[0]];
  113.  
  114. array.forEach(function(val) {
  115. if (!modeMap[val]) modeMap[val] = 1;
  116. else modeMap[val]++;
  117.  
  118. if (modeMap[val] > maxCount) {
  119. modes = [val];
  120. maxCount = modeMap[val];
  121. }
  122. else if (modeMap[val] === maxCount) {
  123. modes.push(val);
  124. maxCount = modeMap[val];
  125. }
  126. });
  127. return modes;
  128. },
  129.  
  130. variance: function(array) {
  131. var mean = arr.mean(array);
  132. return arr.mean(array.map(function(num) {
  133. return Math.pow(num - mean, 2);
  134. }));
  135. },
  136.  
  137. standardDeviation: function(array) {
  138. return Math.sqrt(arr.variance(array));
  139. },
  140.  
  141. meanAbsoluteDeviation: function(array) {
  142. var mean = arr.mean(array);
  143. return arr.mean(array.map(function(num) {
  144. return Math.abs(num - mean);
  145. }));
  146. },
  147.  
  148. zScores: function(array) {
  149. var mean = arr.mean(array);
  150. var standardDeviation = arr.standardDeviation(array);
  151. return array.map(function(num) {
  152. return (num - mean) / standardDeviation;
  153. });
  154. }
  155. };
  156.  
  157. var description = ``
  158. /**
  159. * Syntax to use game_array.push(new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base))
  160. * @param set_return_to_base(true)
  161. * @param turn_max_bet_in_turns(false)
  162. * @param get_multiplier(target)
  163. * @param get_formula_multiplier(target)
  164. * @param get_stw(target)
  165. * @param get_random()
  166. * @param turn_all_strategies(false)
  167. * @param kill_strategy(game_type)
  168. */
  169. async function load_pattern() {
  170. delete_strategies()
  171. let cost = ``
  172. let listing = ``
  173. let sectors = 8
  174. let multipliers = 1.1165 + RISK_MULTIPLIER
  175. let targets = 9.44 * ex.mul_target
  176. let STWS = 0
  177. let turns = 0
  178. game_array = []
  179.  
  180. switch (setup) {
  181. case 1:
  182. description = `Create randomized targets, with random bets, turns, stws`
  183.  
  184. ex.disable_target_at_bust = true
  185. ex.increase_STW_by_same_targets = false
  186. ex.increasing_bets_at_peak = true
  187. ex.reset_STW_after_game_pass = false
  188. ex.reset_all_after_win = true
  189. for (let i = 1; i < sectors; i++) {
  190. let rnd_bet = 5
  191. let rnd_target = 16
  192. let rnd_turn = 5
  193.  
  194. let temp = get_random(1.2) * rnd_target
  195. game_array.push(new Strategy(temp, get_random(1.5) * rnd_bet, get_random(1.2) * rnd_turn, 0, get_formula_multiplier(temp) + RISK_MULTIPLIER, true))
  196. }
  197. do_sort_random()
  198. break;
  199. case 2:
  200. description = `Segmentar for 9.44 with 8 max turns and 8 stw and high various Math.pow`
  201.  
  202. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.6), 8, 8, multipliers))
  203. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.8), 6, 8, multipliers))
  204. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.4), 8, 8, multipliers))
  205. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.7), 6, 8, multipliers))
  206.  
  207. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.1), 8, 8, multipliers))
  208. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.3), 8, 8, multipliers))
  209. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.5), 8, 8, multipliers))
  210. game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.72), 6, 8, multipliers))
  211. break;
  212. case 3:
  213. description = `Segmentar for 9.44 with 8 max turns and 8 stw`
  214.  
  215. game_array.push(new Strategy(targets, Math.pow(5, 2.72), 8, 8, multipliers))
  216. game_array.push(new Strategy(targets, Math.pow(6, 2.72), 8, 8, multipliers))
  217. game_array.push(new Strategy(targets, Math.pow(7, 2.72), 8, 8, multipliers))
  218. game_array.push(new Strategy(targets, Math.pow(8, 2.72), 8, 8, multipliers))
  219.  
  220. game_array.push(new Strategy(targets, Math.pow(9, 2.72), 8, 8, multipliers))
  221. game_array.push(new Strategy(targets, Math.pow(10, 2.72), 8, 8, multipliers))
  222. game_array.push(new Strategy(targets, Math.pow(11, 2.72), 8, 8, multipliers))
  223. game_array.push(new Strategy(targets, Math.pow(12, 2.72), 8, 8, multipliers))
  224.  
  225. break;
  226. case 4:
  227. description = `Segmentar for 9.44 with return to base`
  228.  
  229. game_array.push(new Strategy(targets, 1, 8, 8, 1.14, true))
  230. game_array.push(new Strategy(targets, 5, 7, 8, 1.14, true))
  231. game_array.push(new Strategy(targets, 8, 8, 8, 1.14, true))
  232. game_array.push(new Strategy(targets, 10, 14, 16, 1.14, true))
  233.  
  234. game_array.push(new Strategy(targets, 14, 8, 24, 1.135, true))
  235. game_array.push(new Strategy(targets, 19, 12, 24, 1.135, true))
  236. game_array.push(new Strategy(targets, 25, 12, 24, 1.15, true))
  237. game_array.push(new Strategy(targets, 33, 8, 24, 1.15, true))
  238.  
  239. break;
  240. case 5:
  241. description = `Segmentar for 9.44 with memory, insanity risk for crazy profit`
  242.  
  243. game_array.push(new Strategy(9.44, 100, 22, 1, 1.119, false))
  244. game_array.push(new Strategy(9.44, 307, 22, 2, 1.5, false))
  245. game_array.push(new Strategy(9.44, 1270, 22, 3, 1.75, false))
  246. game_array.push(new Strategy(9.44, 6113, 22, 4, 1.99, false))
  247. break;
  248. case 6:
  249. description = `Many high targets`
  250.  
  251. for (let i = 1; i < sectors; i++) {
  252. game_array.push(new Strategy(i * 50, 1))
  253. }
  254. for (let i = 1; i < 3; i++) {
  255. game_array.push(new Strategy(i * 10000, 1))
  256. }
  257. for (let i = 1; i < 11; i++) {
  258. game_array.push(new Strategy(i * 1.5, 1, i * 1.5))
  259. }
  260. break;
  261. case 7:
  262. description = `4.72x 9.09x 15x 30x 60x 19x 25x 9.44x 50x 12x 8.4x 5.4x with limited max turns`
  263.  
  264. game_array.push(new Strategy(4.72, 1, 10, get_stw(4.72), get_formula_multiplier(4.72), false))
  265. game_array.push(new Strategy(9.09, 1, 15, get_stw(9.09), get_formula_multiplier(9.09), false))
  266. game_array.push(new Strategy(15, 1, 30, get_stw(15), get_formula_multiplier(15), false))
  267. game_array.push(new Strategy(30, 1, 40, get_stw(30), get_formula_multiplier(30), false))
  268.  
  269. game_array.push(new Strategy(60, 1, 40, get_stw(60), get_formula_multiplier(60), false))
  270. game_array.push(new Strategy(19, 1, 30, get_stw(19), get_formula_multiplier(19), false))
  271. game_array.push(new Strategy(25, 1, 30, get_stw(25), get_formula_multiplier(25), false))
  272. game_array.push(new Strategy(9.44, 1, 13, get_stw(9.44), get_formula_multiplier(9.44), false))
  273.  
  274. game_array.push(new Strategy(50, 1, 25, get_stw(50), get_formula_multiplier(50), false))
  275. game_array.push(new Strategy(12, 1, 15, get_stw(12), get_formula_multiplier(12), false))
  276. game_array.push(new Strategy(8.4, 1, 12, get_stw(8.4), get_formula_multiplier(8.4), false))
  277. game_array.push(new Strategy(5.4, 1, 10, get_stw(5.4), get_formula_multiplier(5.4), false))
  278.  
  279. game_array.push(new Strategy(70, 1, 25, get_stw(70), get_formula_multiplier(70), false))
  280. game_array.push(new Strategy(80, 1, 20, get_stw(80), get_formula_multiplier(80), false))
  281. game_array.push(new Strategy(100, 1, 15, get_stw(100), get_formula_multiplier(100), false))
  282. game_array.push(new Strategy(200, 1, 25, get_stw(200), get_formula_multiplier(200), false))
  283.  
  284. updateData(0)
  285. do_sort_incremental()
  286. break;
  287. case 8:
  288. description = `4.72x 9.09x 14.36x 30x 60x 19x 25x 7.07x 50x 12x 8.4x 5.4x`
  289.  
  290. game_array.push(new Strategy(4.72, 1, 20))
  291. game_array.push(new Strategy(9.09, 1, 8))
  292. game_array.push(new Strategy(14.36, 1, 37))
  293. game_array.push(new Strategy(30, 1, 20))
  294.  
  295. game_array.push(new Strategy(60, 1, 15))
  296. game_array.push(new Strategy(19, 1, 8))
  297. game_array.push(new Strategy(25, 1, 8))
  298. game_array.push(new Strategy(7.07, 1, 5))
  299.  
  300. game_array.push(new Strategy(50, 1, 10))
  301. game_array.push(new Strategy(12, 1, 10))
  302. game_array.push(new Strategy(8.4, 1, 6))
  303. game_array.push(new Strategy(5.4, 1, 5))
  304. turn_max_bet_in_turns(false)
  305. //game_array.push(new Strategy(14.36, 2, 37, get_stw(14.36),1.16,true))
  306.  
  307. updateData(0)
  308. do_sort_incremental()
  309. break;
  310. case 9:
  311. description = `Single 5x play`
  312. game_array.push(new Strategy(5, 1, 60, 0, 1.27, true))
  313. break;
  314. case 10:
  315. description = `Segmentar 9.44x, Math.pow 2.72 and configurated OP`
  316.  
  317. ex.disable_target_at_bust = false
  318. ex.increase_STW_by_same_targets = false
  319. ex.increasing_bets_at_peak = false
  320. ex.reset_STW_after_game_pass = false
  321. ex.reset_all_after_win = true
  322. for (let i = 1; i < 6; i++) {
  323. game_array.push(new Strategy(9.44, Math.pow(i, 2.72), 53 - (i * 3), 9 * i, get_formula_multiplier(9.44), true))
  324. }
  325. //turn_max_bet_in_turns(false)
  326. break;
  327. case 11:
  328. description = `9.44x 15x 25x with max turns and semi-memoryzed targets`
  329.  
  330. ex.disable_target_at_bust = false
  331. ex.increasing_bets_at_peak = false
  332. ex.reset_STW_after_game_pass = true
  333. ex.increase_STW_by_same_targets = false
  334. ex.reset_all_after_win = false
  335.  
  336. game_array.push(new Strategy(25, Math.pow(1, 2.72), 50, 52, get_formula_multiplier(25), false))
  337. game_array.push(new Strategy(15, Math.pow(1, 2.72), 25, 26, get_formula_multiplier(15), false))
  338. game_array.push(new Strategy(9.44, Math.pow(1, 2.72), 25, 10, get_formula_multiplier(9.44), true))
  339.  
  340. turn_max_bet_in_turns(true)
  341.  
  342. break;
  343. case 12:
  344. description = `OP testing`
  345.  
  346. game_array.push(new Strategy(9.44, Math.pow(1, 2.2), 25, 0, get_formula_multiplier(9.44), false))
  347. game_array.push(new Strategy(5, Math.pow(1, 2), 22, 0, get_formula_multiplier(5), true))
  348. game_array.push(new Strategy(5, Math.pow(3, 2.2), 22, 0, get_formula_multiplier(3), true))
  349. game_array.push(new Strategy(5, Math.pow(1, 2), 22, 0, get_formula_multiplier(4), true))
  350. break;
  351. case 13:
  352. description = `Super-OP with incredible multiplier for second target and high bet size for both`
  353. cost = `1 BTC bankroll`
  354.  
  355. game_array.push(new Strategy(9.44, 100, 22, 0, 1.12, false))
  356. game_array.push(new Strategy(9.44, 308, 22, 0, 1.5, false))
  357.  
  358. break;
  359. case 14:
  360. description = `soft-OP 2 targets of 9.44, high multiplier for second target`
  361. game_array.push(new Strategy(9.44, 1, 22, 0, 1.09, true))
  362. game_array.push(new Strategy(9.44, 3, 22, 0, 1.3, true))
  363.  
  364. break;
  365. case 15:
  366. description = `soft-OP 4 targets of 9.44 and various multipliers from low to high`
  367.  
  368. game_array.push(new Strategy(9.44, 5, 22, 0, 1.12, true))
  369. game_array.push(new Strategy(9.44, 5, 22, 0, 1.3, true))
  370. game_array.push(new Strategy(9.44, 15, 22, 0, 1.18, true))
  371. game_array.push(new Strategy(9.44, 30, 22, 0, 1.15, true))
  372.  
  373. break;
  374. case 16:
  375. description = `soft-OP Will RIP Bustadice soon, its version 2`
  376.  
  377. ex.reset_STW_after_game_pass = false
  378. ex.reset_all_after_win = true
  379. for (let i = 1; i < OP.Loops; i++) {
  380. game_array.push(new Strategy(OP.Target_High.target, Math.ceil(Math.sqrt(i)), OP.Target_High.max_turns, 11 * i, OP.Target_High.multiplier, true))
  381. game_array.push(new Strategy(OP.Target_Low.target, Math.pow(i, OP.Target_Low.exponential), OP.Target_Low.max_turns, 5 * i, OP.Target_Low.multiplier, true))
  382. }
  383. /*for (let i = 1; i < 16; i++) {
  384. // this line if actually was used at night run when we was profiting and scale it by risk base increase, 1 btc = risk base = 9, 2 btc risk base =18 etc
  385. game_array.push(new Strategy(9.44, Math.pow(i,2.72), 8, 11*i, get_formula_multiplier(9.44),true))
  386. }*/
  387. break;
  388. case 17:
  389. description = `Standart playing with targets: 4.32x, 7.07x and 13.5x`
  390.  
  391. game_array.push(new Strategy(4.32, 1, 8))
  392. game_array.push(new Strategy(7.07, 1, 8))
  393. game_array.push(new Strategy(13.5, 1, 9))
  394. updateData(0)
  395. turn_max_bet_in_turns(false)
  396. do_sort_incremental()
  397.  
  398. break;
  399. case 18:
  400. description = `2.36x, 4.72x 9.44x safety`
  401. cost = `250.000 bits bankroll`
  402.  
  403. game_array.push(new Strategy(2.36, 5))
  404. game_array.push(new Strategy(4.72, 4))
  405. game_array.push(new Strategy(9.44, 2))
  406.  
  407. //game_array.push(new Strategy(15, 1))
  408. //game_array.push(new Strategy(30, 1))
  409. //game_array.push(new Strategy(60, 1))
  410.  
  411. break;
  412. case 19:
  413. description = `2.36x, 4.72x 9.44x 15x 30x 60x safety`
  414. cost = `2 BTC bankroll`
  415.  
  416. game_array.push(new Strategy(2.36, 22))
  417. game_array.push(new Strategy(4.72, 12))
  418. game_array.push(new Strategy(9.44, 3))
  419. game_array.push(new Strategy(15, 1))
  420. game_array.push(new Strategy(30, 1))
  421. game_array.push(new Strategy(60, 16))
  422.  
  423. //game_array.push(new Strategy(100, 2))
  424.  
  425. break;
  426. case 20:
  427. description = `2.36x, 4.72x 9.44x 15x 30x 60x safety`
  428. cost = `4 BTC bankroll`
  429.  
  430. game_array.push(new Strategy(2.36, 22))
  431. game_array.push(new Strategy(4.72, 30))
  432. game_array.push(new Strategy(9.44, 4))
  433. game_array.push(new Strategy(15, 12))
  434. game_array.push(new Strategy(30, 3))
  435. game_array.push(new Strategy(60, 8))
  436.  
  437. //game_array.push(new Strategy(100, 2))
  438.  
  439. break;
  440. case 21:
  441. description = `5x plays in 3 seed diffculty ranges`
  442.  
  443. ex.reset_STW_after_game_pass = false
  444. game_array.push(new Strategy(5, 1, 13, 13, get_formula_multiplier(5), true))
  445. game_array.push(new Strategy(5, 15, 13, 26, get_formula_multiplier(5), true))
  446. game_array.push(new Strategy(5, 100, 13, 39, get_formula_multiplier(5), true))
  447.  
  448. break;
  449. case 22:
  450. description = `Median formula in use`
  451.  
  452. game_array.push(new Strategy(5, 1, 0, 13, get_formula_multiplier(5), true))
  453. game_array[0].ACTION = async function () { await strategy_median(this) };
  454. for (let i = 1; i <= queue; i++){
  455. const { multiplier } = await engine.skip()
  456. cargo.push(multiplier)
  457. }
  458.  
  459. break;
  460. default:
  461. for (let i = 1; i < game_array.length; i++) {
  462. game_array.push(new Strategy(targets, i, 8, 9 * i, get_formula_multiplier(targets), true))
  463. }
  464. }
  465. engine.log(`Setup [${setup}] [${description}] [${cost}] being initialized.`)
  466. await sleep(1500)
  467.  
  468. engine.log(`There is list of ${game_array.length} strategies will play:`)
  469. await sleep(1500)
  470. let arr_tar = []
  471. for (let i = 0; i < game_array.length; i++) {
  472. listing = listing + `${game_array[ i ].target}x, `
  473. arr_tar.push(game_array[i].target)
  474. }
  475. engine.log(arr.median(arr_tar))
  476. engine.log(listing)
  477. await sleep(2500)
  478.  
  479. //updateData(RISK_FACTOR)
  480. }
  481. function set_return_to_base(isOn = false) {
  482. if (isOn == true) {
  483. for (let i = 0; i < game_array.length; i++) {
  484. game_array[ i ].RETURN_BASE = true
  485. }
  486. } else {
  487. for (let i = 0; i < game_array.length; i++) {
  488. game_array[ i ].RETURN_BASE = false
  489. }
  490. }
  491. }
  492. function turn_max_bet_in_turns(Enabled = false) {
  493. if (Enabled == true) {
  494. for (let i = 0; i < game_array.length; i++) {
  495. if (game_array[ i ].target == 2.36) {
  496. game_array[ i ].MAX_BET_TURNS = 4
  497. } else if (game_array[ i ].target == 4.72) {
  498. game_array[ i ].MAX_BET_TURNS = 22
  499. } else if (game_array[ i ].target == 9.44) {
  500. game_array[ i ].MAX_BET_TURNS = 35
  501. } else if (game_array[ i ].target == 15) {
  502. game_array[ i ].MAX_BET_TURNS = 60
  503. } else if (game_array[ i ].target == 30) {
  504. game_array[ i ].MAX_BET_TURNS = 60
  505. } else if (game_array[ i ].target == 60) {
  506. game_array[ i ].MAX_BET_TURNS = 90
  507. } else if (game_array[ i ].target == 100) {
  508. game_array[ i ].MAX_BET_TURNS = 100
  509. }
  510. }
  511. } else {
  512. for (let i = 0; i < game_array.length; i++) {
  513. game_array[ i ].MAX_BET_TURNS = 0
  514. }
  515. }
  516. }
  517.  
  518. var bet_levels_hard_hit_mod = { /* HARD_STYLE TABLE for maximum profit, ps not using it anymore */
  519. T2_36: { base: 26, prev: 2 },
  520. T4_72: { base: 12, prev: 2 },
  521. T9_44: { base: 3, prev: 3 },
  522. T15: { base: 1, prev: 1 },
  523. T30: { base: 1, prev: 1 },
  524. T60: { base: 16, prev: 6 },
  525. T100: { base: 6, prev: 1 },
  526. }
  527. /* New config for easy access 16th strategy, which will rip bustadice soon */
  528. var OP = {
  529. Loops: 6,
  530. Target_High: {
  531. target: 9.44,
  532. multiplier: get_formula_multiplier(9.44),
  533. exponential: 2.2,
  534. max_turns: 5,
  535. },
  536. Target_Low: {
  537. target: 4.72,
  538. multiplier: get_formula_multiplier(4.72),
  539. exponential: 2.4,
  540. max_turns: 6,
  541. },
  542. }
  543. /* TODO, undone yet */
  544. async function check_multiplier(basebet, multiplier, turns) {
  545. let expression = basebet
  546. let result = engine.balance / 100
  547. let FOUND = false
  548. let step = 0
  549. let prevesious_result = 0
  550. let cost = 0
  551. let turns_output
  552.  
  553. if (turns != undefined) {
  554. turns_output = `TURNS [${turns}]`
  555. } else {
  556. turns_output = ``
  557. }
  558.  
  559. engine.log(`-- Starting calculation -- BASEBET [${expression}] MULTIPLIER [${multiplier}] ` + turns_output)
  560.  
  561. await sleep(200)
  562. while (!FOUND) {
  563. step++
  564. if (turns != undefined) {
  565. if (turns >= step) {
  566. FOUND = true
  567. engine.log(`${turns}`)
  568. await sleep(1000)
  569. }
  570. }
  571. await sleep(50)
  572. prevesious_result = expression
  573. expression = expression * multiplier
  574. engine.log(`${Math.round(expression)} * ${multiplier} = ${Math.round(expression) * multiplier}`)
  575. cost = cost + expression
  576. if (cost >= result) {
  577. cost = cost - expression
  578. expression = expression - prevesious_result
  579. step--
  580. FOUND = true
  581. engine.log(`Result: ${Math.round(cost)} Turn: ${step}`)
  582. await sleep(3000)
  583. }
  584. engine.log(`Wager ${Math.round(expression)} Turn ${step}`)
  585. }
  586. return Math.round(expression)
  587. }
  588. function math_cost(game_type) {
  589. let cost = 0
  590. let result = 0
  591. let bet_size = game_type.basebet
  592. let balance = engine.balance / 100
  593. let turns = 0
  594. while (cost < balance) {
  595. turns++
  596. bet_size = bet_size * game_type.multiplier
  597. cost = cost + bet_size
  598. engine.log(`${turns}, bet ${Math.round(bet_size)}, cost ${Math.round(cost)} bits`)
  599. }
  600. return result, cost, turns, bet_size
  601. }
  602. async function calculate_bankroll() {
  603. for (let i = 0; i < game_array.length; i++) {
  604. engine.log(`Calculating bets for ${game_array[ i ].target}x, base bet ${game_array[ i ].basebet}`)
  605. engine.log(`${game_array[ i ].target}x, mul ${game_array[ i ].multiplier.toFixed(4)}`)
  606. let balance = engine.balance / 100
  607.  
  608. let turns = 0
  609. let start_bet_size = game_array[ i ].basebet
  610. let bet_size = start_bet_size
  611. let cost = start_bet_size
  612. let longest = Math.round(game_array[ i ].target * LONGEST_DIFFCULTY)
  613. let STW = 0
  614.  
  615.  
  616. while (turns + STW < longest) {
  617. turns++
  618. //engine.log(`${turns}, bet ${Math.round(bet_size)}, cost ${Math.round(cost)} bits`)
  619. bet_size *= game_array[ i ].multiplier
  620. cost = cost + bet_size
  621.  
  622. if (cost > balance) {
  623. turns--
  624. STW++
  625. cost = cost - bet_size
  626. //STW = longest - turns
  627. start_bet_size = start_bet_size - 1
  628. if (start_bet_size <= 0) {
  629. start_bet_size = 1
  630. STW = Math.round(STW + (longest / 4 / 4))
  631. }
  632. //await sleep(500)
  633.  
  634. if (turns + STW < longest) {
  635. //start_bet_size = start_bet_size + 1
  636. bet_size = start_bet_size
  637. turns = 0
  638. cost = 0
  639. // await engine.stop()
  640. //continue
  641. } else {
  642. engine.log(`Solution found`)
  643. game_array[ i ].bet = start_bet_size
  644. game_array[ i ].basebet = start_bet_size
  645.  
  646. //return
  647. //engine.log(`OK safe enough now with ${STW} STW`)
  648. //return
  649. }
  650.  
  651. } else {
  652. game_array[ i ].STW = STW
  653. game_array[ i ].bet = start_bet_size
  654. game_array[ i ].basebet = start_bet_size
  655.  
  656. }
  657. engine.log(`${game_array[ i ].target}x STW: ${game_array[ i ].STW}, max cost ${Math.round(cost)} bits , multiplier ${game_array[ i ].multiplier.toFixed(4)}, for base_bet ${start_bet_size}, max bet ${Math.round(bet_size)}, turns ${turns} safe is ${longest}`)
  658. }
  659. }
  660. }
  661.  
  662. const engine = this
  663. let results = [];
  664. var bust_text = ``
  665. var bust_array = []
  666. var last_strategy = `none`
  667. var change_seed_next = change_seed_next_STW
  668. var game_array = []
  669. var session_value = ex.nyan_hunting.sessionProfit
  670. this.log('Data loaded...... OK')
  671.  
  672. async function preload_setup_script() {
  673. if (ex.bankroll_settings == false) {
  674.  
  675. } else {
  676. if (engine.balance / 100 <= 2000000) {
  677. setup = 18
  678. }
  679. if (engine.balance / 100 >= 2000000) {
  680. setup = 19
  681. }
  682. if (engine.balance / 100 >= 4000000) {
  683. setup = 20
  684. }
  685. }
  686. if (ex.calculate_base == true) {
  687. await calculate_bankroll()
  688. }
  689. setSeed_rules()
  690. await load_pattern()
  691. }
  692. var PLAY_HARD = false
  693. var STREAK_ROLL = 0
  694. var output_message = ``
  695. var notification_timeout = 5
  696.  
  697. let skipStep = 1 /* 0 = skip | 1 = bet */
  698. let nonce = 0
  699. let PROFIT = 0
  700. let TOTAL_BETS = 0
  701. let hard_style_played = 0
  702. let skip_enabled = true
  703.  
  704. let profit_times = 0
  705. let TOTAL_WINS = 0
  706. let output_msg = ``
  707. let queue = []
  708.  
  709. const RISK_MULTIPLIER_DEFAULT = RISK_MULTIPLIER
  710. const RISK_FACTOR_DEFAULT = RISK_FACTOR
  711. const RISK_BASE_DEFAULT = RISK_BASE
  712. const queueSize = 5
  713.  
  714. const ver = 1.3
  715.  
  716. engine.log(`Starting to gather information script made by by Baecoin. v${ver}`)
  717.  
  718.  
  719. /* Main loop is starting from here */
  720. const main = async () => {
  721. await preload_setup_script()
  722.  
  723. while (true) {
  724. await gather_information()
  725. for (let igo = 0; igo < game_array.length; igo++) {
  726.  
  727. if (game_array[ igo ].enabled) {
  728. await game_array[ igo ].ACTION()
  729. }
  730. }
  731. }
  732. }
  733. /* Prevent script from lost connection to server */
  734. while (true) {
  735. try {
  736. await main();
  737. } catch (error) {
  738. if (error.message === "connection closed") {
  739. await this.log("Connection closed. Restarting script");
  740. continue;
  741. } else {
  742. throw error;
  743. }
  744. }
  745. }
  746.  
  747. async function gather_information() {
  748. //await sleep(ex.interval_rolls)
  749. if (ex.fast_betting.enabled == true) {
  750. await fast_betting()
  751. } else if (ex.fast_betting.enabled == false) {
  752. await normal_betting()
  753. }
  754.  
  755. }
  756.  
  757. async function fastBet() {
  758. const result = skip_enabled ? skipStep ? await engine.bet(100, ex.fast_betting.chase) : await engine.bet(100, ex.fast_betting.chase) : await engine.bet(100, ex.fast_betting.chase);
  759. skipStep = !skipStep;
  760. return result;
  761. }
  762. async function analyzeBet() {
  763. const result = skip_enabled ? skipStep ? await engine.bet(100, 1.01) : await engine.skip() : await engine.bet(100, 1.01);
  764. skipStep = !skipStep;
  765. return result;
  766. }
  767.  
  768. /**
  769. * Updates STW with multipliers
  770. * @param multiplier Outcome of last game result.
  771. */
  772. async function updateStreaks(multiplier) {
  773. for (let i = 0; i < game_array.length; i++) {
  774. if (multiplier < game_array[ i ].target) {
  775. game_array[ i ].LS++
  776. } else if (multiplier > game_array[ i ].target) {
  777. game_array[ i ].LS = 0
  778. game_array[ i ].MISSED++
  779.  
  780. } else {
  781. if (ex.reset_STW_after_game_pass == true) {
  782. game_array[ i ].LS = 0 // Reset all while playing
  783. }
  784.  
  785. }
  786. }
  787. }
  788. /**
  789. * Sort strategies randomly, works only when RISK_FACTOR set to 0.
  790. */
  791. function do_sort_random() {
  792. game_array.sort(function (a, b) { return 0.5 - Math.random() });
  793. }
  794. /**
  795. * Sort strategies incremental in amount of target, from low to high, works only when RISK_FACTOR set to 0.
  796. */
  797. function do_sort_incremental() {
  798. game_array.sort(function (a, b) { return a.target - b.target });
  799. }
  800. /**
  801. * Sort strategies decremental in amount of target, from high to low, works only when RISK_FACTOR set to 0.
  802. */
  803. function do_sort_decremental() {
  804. game_array.sort(function (a, b) { return b.target - a.target });
  805. }
  806. /**
  807. * Sort strategies decremental by bet size in memory, from high to low, works only when RISK_FACTOR set to 0.
  808. */
  809. function do_sort_bet_size_decremental() {
  810. game_array.sort(function (a, b) { return b.bet - a.bet });
  811. }
  812. /**
  813. * Returns index for highest target value
  814. */
  815. function game_array_get_max() {
  816. var len = game_array.length
  817. var max = -Infinity;
  818. var position = Infinity;
  819. while (len--) {
  820. if (game_array[ len ].target > max) {
  821. max = game_array[ len ].target;
  822. position = game_array[ len ];
  823. }
  824. }
  825. return position;
  826. }
  827. /**
  828. * Returns index for lowest target value
  829. */
  830. function game_array_get_min() {
  831. var len = game_array.length
  832. var min = Infinity;
  833. var position = Infinity;
  834. while (len--) {
  835. if (game_array[ len ].target < min) {
  836. min = game_array[ len ].target;
  837. position = game_array[ len ];
  838. }
  839. }
  840. return position;
  841. }
  842. /**
  843. * Returns highest target value
  844. */
  845. function game_array_target_max() {
  846. var len = game_array.length
  847. var max = -Infinity;
  848. while (len--) {
  849. if (game_array[ len ].target > max) {
  850. max = game_array[ len ].target;
  851. }
  852. }
  853. return max;
  854. }
  855. /**
  856. * Returns lowest target value
  857. */
  858. function game_array_target_min() {
  859. var len = game_array.length
  860. var min = Infinity;
  861. while (len--) {
  862. if (game_array[ len ].target < min) {
  863. min = game_array[ len ].target;
  864. }
  865. }
  866. return min;
  867. }
  868. function bust_counter(impact) {
  869. if (bust_array.length >= 50) {
  870. bust_array = []
  871. bust_text = ""
  872. } else {
  873. bust_text = bust_text + " " + impact + " "
  874. }
  875. bust_array.push(impact)
  876. }
  877. async function Summary(streak_count) {
  878. let main_number_who_trigger = 9.44
  879. let current_streak = streak_count
  880. let STYLE_PLAY = LONGEST_DIFFCULTY / ex.hard_style.streak_range
  881. if (last_strategy == main_number_who_trigger && PLAY_HARD != true) {
  882. if (current_streak >= Math.round(main_number_who_trigger * STYLE_PLAY)) {
  883. if (PROFIT > 0 && ex.hard_style.enabled == true) {
  884. hit_hard(true)
  885. }
  886. }
  887. }
  888. if (ex.hard_style.enabled == true) {
  889. await notification(`Game ended in amount ${current_streak} streak, to trigger hard play style ${Math.round(main_number_who_trigger * STYLE_PLAY)} on ${main_number_who_trigger}x strategy`)
  890. }
  891. STREAK_ROLL = current_streak
  892. }
  893. async function notification_update() {
  894. if (notification_timeout <= 0) {
  895. output_message = `No Status`
  896. notification_timeout = 5
  897. }
  898. notification_timeout--
  899. }
  900.  
  901. function notification(message) {
  902. output_message = message
  903. engine.log(`${output_message}`)
  904. }
  905. function log_busting_to_console() {
  906. engine.log(`${output_msg}`)
  907. engine.log(`Script bust ${profit_times}/${HIT_MIN_PROFIT_TIMES} times, Winning ${TOTAL_WINS} times`)
  908. }
  909. function hard_style_logging() {
  910. let output = ``
  911. if (hard_style_played > 0) {
  912. output = `, hard style hits was ${hard_style_played} times`
  913. } else {
  914. output = ``
  915. }
  916. return output
  917. }
  918. /**
  919. * Updates data to values after switching features like hard play.
  920. */
  921. function updateData(UPDATED_RISK_FACTOR = RISK_FACTOR_DEFAULT) {
  922. if (UPDATED_RISK_FACTOR != undefined) {
  923. for (let i = 0; i < game_array.length; i++) {
  924. if (game_array[ i ].STW == 0) {
  925. game_array[ i ].STW = Math.round((game_array[ i ].target * ex.mul_target) * LONGEST_DIFFCULTY / PLAY_IN_RANGE * UPDATED_RISK_FACTOR)
  926. }
  927. }
  928. } else {
  929. for (let i = 0; i < game_array.length; i++) {
  930. game_array[ i ].STW = 0
  931. }
  932. }
  933. }
  934. /**
  935. * Updates all output logging.
  936. */
  937. async function updateLog() {
  938. engine.clearLog()
  939. log_busting_to_console()
  940. engine.log(`Rolls: ${TOTAL_BETS} Seed: ${nonce}/${change_seed_next} last run Strategy ${last_strategy}x at streak ${STREAK_ROLL}` + hard_style_logging())
  941. engine.log(stats_show() + `Profit: ${PROFIT.toFixed(2)}`)
  942. if (ex.advanced_log) {
  943. engine.log(output_message)
  944. }
  945. if (ex.advanced_log && ex.hard_style.enabled) {
  946. engine.log(`Bust data: ${bust_text}`)
  947. if (PLAY_HARD) {
  948. engine.log('HARD-PLAY MODE!')
  949. }
  950. }
  951. }
  952. /**
  953. * Returns data as string with updated information on each multiplier.
  954. */
  955. function stats_show() {
  956. let output = ``
  957. let status = ``
  958. for (let i = 0; i < game_array.length; i++) {
  959. if (game_array[ i ].enabled == true) {
  960. if (ex.advanced_log) {
  961. status = `${game_array[ i ].target.toFixed(2)}x base: ${game_array[ i ].basebet}, multiplier ${game_array[ i ].multiplier.toFixed(5)}, run ${game_array[ i ].RUNS} times. Could catch: ${game_array[ i ].MISSED}, streaks: last ${game_array[ i ].STREAK_ROLL}, max ${game_array[ i ].MAX_STREAK}, PROFIT: ${game_array[ i ].PROFIT.toFixed()}`
  962. if (game_array[ i ].MAX_BET_TURNS > 0) { status = status + `, cycle ${game_array[ i ].CYCLES_PAST}` }
  963. }
  964. if (game_array[ i ].STW != 0) {
  965. output = output + `${game_array[ i ].target.toFixed(2)}x: ${game_array[ i ].LS}/${game_array[ i ].STW} | `
  966. } else {
  967. output = output + `${game_array[ i ].target.toFixed(2)}x: next bet ${Math.round(game_array[ i ].bet)} | `
  968. }
  969. } else {
  970. status = `Offline. ${game_array[ i ].target.toFixed(2)}x with end bet: ${game_array[ i ].bet}`
  971. }
  972. engine.log(status)
  973. }
  974. return output
  975. }
  976. function max_win_reach() {
  977. PROFIT = 0
  978. TOTAL_WINS++
  979. //reset_bets()
  980. if (HIT_MIN_PROFIT_TIMES == 0 || TOTAL_WINS >= HIT_MAX_PROFIT_TIMES) {
  981. engine.log(`You reached max profit limit, stopping script`)
  982. engine.stop()
  983. }
  984. }
  985. /**
  986. * When condition was met, do update bust counter and stop script if necessery.
  987. */
  988. async function condition_to_bust(game_strategy) {
  989. if (PROFIT > maxProfit) {
  990. max_win_reach()
  991. } else {
  992. profit_times++
  993. if (profit_times >= HIT_MIN_PROFIT_TIMES) {
  994. engine.log(`Script lost ${profit_times} times, so it is stopping`)
  995. engine.stop()
  996. } else {
  997. output_msg = `Script lost once more and now ${profit_times}/${HIT_MIN_PROFIT_TIMES} before stop`
  998. PROFIT = 0
  999. reset_bets()
  1000. await generateSeed()
  1001. if (ex.disable_target_at_bust == true) {
  1002. kill_strategy(game_strategy)
  1003. }
  1004. }
  1005. }
  1006. }
  1007. function do_ressurect_disabled_targets() {
  1008. for (let i = 0; i < game_array.length; i++) {
  1009. if (game_array[ i ].enabled == false) {
  1010. game_array[ i ].enabled = true
  1011. engine.log(`${game_array[ i ].target}x ressurected`)
  1012. }
  1013.  
  1014. }
  1015. do_sort_bet_size_decremental()
  1016. }
  1017. function delete_strategies() {
  1018. game_array = []
  1019. }
  1020. function betSize(bet) {
  1021. return Math.round((bet * 100) / 100) * 100
  1022. }
  1023. function get_formula_multiplier(target) {
  1024. return (1 / ((target * ex.mul_target) - 1) + 1) + (RISK_MULTIPLIER * (1 / ((target * ex.mul_target) - 1) + 1))
  1025. }
  1026. function get_longest_streak(target) {
  1027. return Math.round((target * ex.mul_target) * LONGEST_DIFFCULTY)
  1028. }
  1029. function get_stw(target) {
  1030. return Math.round(get_longest_streak(target) / PLAY_IN_RANGE * RISK_FACTOR)
  1031. }
  1032. function get_multiplier(target, fixit = 4) {
  1033. return (1 / (target - 1) + 1).toFixed(fixit)
  1034. }
  1035. function increase_profit(game_type) {
  1036. if (ex.nyan_hunting.enabled && game_type.target >= ex.nyan_hunting.sessionTarget) {
  1037. session_value = ex.nyan_hunting.sessionProfit
  1038. }
  1039. return (betSize(game_type.bet) / 100) * (game_type.target - 1)
  1040. }
  1041. function decrease_profit(game_type) {
  1042. return betSize(game_type.bet) / 100
  1043. }
  1044. function get_random(power = 1.5) {
  1045. return power - Math.random()
  1046. }
  1047. function turn_all_strategies(isOn = true) {
  1048. for (let i = 0; i < game_array.length; i++) {
  1049. game_array[ i ].enabled = isOn
  1050. engine.log(`Strategy ${game_array[ i ].target} was set to ${game_array[ i ].enabled}`)
  1051. }
  1052. }
  1053. function kill_strategy(game_type) {
  1054. game_type.enabled = false
  1055. engine.log(`Strategy ${game_type.target} was set to ${game_type.enabled}`)
  1056. }
  1057. function session_start(game_strategy) {
  1058. if (ex.nyan_hunting.enabled && game_strategy.target >= ex.nyan_hunting.sessionTarget && sessionValue > 0) {
  1059. game_strategy.bet = ex.nyan_hunting.sessionBet
  1060. if (session_value <= 0) {
  1061. session_value = ex.nyan_hunting.sessionProfit
  1062. game_strategy.bet = game_strategy.basebet_default
  1063. } else {
  1064. session_value -= ex.nyan_hunting.sessionBet
  1065. }
  1066.  
  1067. }
  1068. }
  1069. async function strategy_play(game_strategy) {
  1070. var cycles_activation = 0
  1071. let RETRY = true
  1072. if (game_strategy.LS < game_strategy.STW) {
  1073. return
  1074. }
  1075. game_strategy.LS = 0
  1076. game_strategy.STREAK_ROLL = 0
  1077.  
  1078. game_strategy.RUNS++
  1079. game_strategy.CYCLES_PAST++
  1080.  
  1081. last_strategy = `${game_strategy.target}`
  1082. cycles_activation = game_strategy.CYCLES_PAST
  1083. gong()
  1084. while (RETRY) {
  1085. if (game_strategy.STREAK_ROLL >= game_strategy.MAX_BET_TURNS && game_strategy.MAX_BET_TURNS != 0) {
  1086. if (game_strategy.RETURN_BASE == true) {
  1087. game_strategy.bet = game_strategy.basebet
  1088. }
  1089. RETRY = false
  1090. return
  1091. }
  1092. session_start(game_strategy)
  1093. const { multiplier } = await engine.bet(betSize(game_strategy.bet), game_strategy.target)
  1094. TOTAL_BETS++
  1095. nonce++
  1096. if (multiplier < game_strategy.target) { // Loose
  1097. game_strategy.STREAK_ROLL++
  1098. PROFIT -= decrease_profit(game_strategy)
  1099. game_strategy.PROFIT -= decrease_profit(game_strategy)
  1100. game_strategy.bet *= game_strategy.multiplier
  1101. if (PROFIT - game_strategy.bet < ex.hard_style.max_loss && PLAY_HARD == true) {
  1102. hit_hard(false)
  1103. RETRY = false
  1104. }
  1105.  
  1106. if (game_strategy.CYCLES_PAST >= 2 && ex.increasing_bets_at_peak == true) {
  1107. if (cycles_activation >= 2) {
  1108. game_strategy.basebet = game_strategy.basebet * 2
  1109. game_strategy.bet = game_strategy.basebet
  1110. updateLog()
  1111. cycles_activation = 0
  1112. }
  1113. }
  1114. } else { // Win
  1115. PROFIT += increase_profit(game_strategy)
  1116. game_strategy.PROFIT += increase_profit(game_strategy)
  1117. game_strategy.bet = game_strategy.basebet
  1118. if (ex.increasing_bets_at_peak == true) {
  1119. if (game_strategy.CYCLES_PAST >= 2) {
  1120. game_strategy.basebet = game_strategy.basebet / 2
  1121. game_strategy.bet = game_strategy.basebet
  1122. cycles_activation = 0
  1123. if (game_strategy.basebet < game_strategy.basebet_default) {
  1124. game_strategy.basebet = game_strategy.basebet_default
  1125. game_strategy.bet = game_strategy.basebet
  1126. }
  1127. updateLog()
  1128. }
  1129. }
  1130.  
  1131. game_strategy.CYCLES_PAST = 0
  1132. RETRY = false
  1133.  
  1134.  
  1135. if (ex.reset_all_after_win == true) {
  1136. reset_bets()
  1137. }
  1138. if (game_array[ 0 ].target == game_array[ game_array.length - 1 ].target && ex.increase_STW_by_same_targets == true) {
  1139. game_strategy.STW++
  1140. }
  1141.  
  1142. //if (PLAY_HARD == true && game_array[game_array_get_max()].enabled != true || game_array[game_array_get_max()].target == game_array_target_max() && PLAY_HARD == true) {
  1143. if (PLAY_HARD == true) {
  1144. hit_hard(false)
  1145. }
  1146. if (ex.reset_STW_after_game_pass == true) {
  1147. updateStreaks(multiplier)
  1148. }
  1149.  
  1150. }
  1151. if (ex.reset_STW_after_game_pass == false) {
  1152. updateStreaks(multiplier)
  1153. }
  1154. Summary(game_strategy.STREAK_ROLL)
  1155. updateLog()
  1156.  
  1157. if (PROFIT > maxProfit || PROFIT - game_strategy.bet < minProfit) {
  1158. RETRY = false
  1159.  
  1160. condition_to_bust(game_strategy)
  1161. }
  1162. if (game_strategy.STREAK_ROLL > game_strategy.MAX_STREAK) {
  1163. game_strategy.MAX_STREAK = game_strategy.STREAK_ROLL
  1164. }
  1165. }
  1166. }
  1167. /**
  1168. * Syntax to use new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base)
  1169. * @param {number} basebet
  1170. * @param {float} target
  1171. * @param {number} max_bet_turns
  1172. * @param {number} STW
  1173. * @param {float} multiplier
  1174. * @param {boolean} return_base
  1175. */
  1176. function Strategy(target = 2, basebet = 1, max_bet_turns = 0, STW = get_stw(target), multiplier = get_formula_multiplier(target), return_base = false) {
  1177. this.target = target;
  1178. this.basebet = Math.round(basebet) * RISK_BASE
  1179. this.basebet_default = Math.round(basebet) * RISK_BASE
  1180. this.bet = Math.round(basebet) * RISK_BASE;
  1181. this.MAX_BET_TURNS = max_bet_turns;
  1182. this.STW = STW;
  1183. this.multiplier = multiplier;
  1184. this.enabled = true;
  1185. this.RETURN_BASE = return_base;
  1186. /* Trigger */
  1187. this.ACTION = async function () { await strategy_play(this) };
  1188. /* Properties */
  1189. this.CYCLES_PAST = 0;
  1190. this.LS = 0;
  1191. this.PROFIT = 0;
  1192. this.RUNS = 0;
  1193. this.MISSED = 0;
  1194. this.STREAK_ROLL = 0;
  1195. this.MAX_STREAK = 0;
  1196. }
  1197.  
  1198. /**
  1199. * Starting strategy run, should be used only when there is gurantee will be high multipliers.
  1200. */
  1201. function hit_hard(isEnabled) {
  1202. if (ex.hard_style.enabled == false) {
  1203. return
  1204. }
  1205. for (let i = 0; i < game_array.length; i++) {
  1206. bet_levels_hard_hit_mod[ i ].prev = Math.round(game_array[ i ].basebet)
  1207. }
  1208. if (isEnabled == true) {
  1209. PLAY_HARD = true
  1210. hard_style_played++
  1211. RISK_FACTOR = 0.0
  1212. RISK_MULTIPLIER = ex.hard_style.multiplier
  1213. updateData(RISK_FACTOR)
  1214. for (let i = 0; i < game_array.length; i++) {
  1215. game_array.multiplier = (1 / ((game_array[ i ].target * ex.mul_target) - 1) + 1) + (ex.hard_style.multiplier * (1 / ((game_array[ i ].target * ex.mul_target) - 1) + 1))
  1216.  
  1217. }
  1218. for (let i = 0; i < game_array.length; i++) {
  1219. game_array[ i ].basebet = Math.round(bet_levels_hard_hit_mod[ i ].base * RISK_BASE)
  1220. game_array[ i ].bet = Math.round(bet_levels_hard_hit_mod[ i ].base * RISK_BASE)
  1221. }
  1222.  
  1223. } else {
  1224. PLAY_HARD = false
  1225.  
  1226. RISK_FACTOR = RISK_FACTOR_DEFAULT
  1227. RISK_MULTIPLIER = RISK_MULTIPLIER_DEFAULT
  1228.  
  1229. for (let i = 0; i < game_array.length; i++) {
  1230. game_array[ i ].basebet = Math.round(bet_levels_hard_hit_mod[ i ].prev * RISK_BASE)
  1231. game_array[ i ].bet = Math.round(bet_levels_hard_hit_mod[ i ].prev * RISK_BASE)
  1232. }
  1233. for (let i = 0; i < game_array.length; i++) {
  1234. game_array.multiplier = (1 / ((game_array[ i ].target * ex.mul_target) - 1) + 1) + (RISK_MULTIPLIER_DEFAULT * (1 / ((game_array[ i ].target * ex.mul_target) - 1) + 1))
  1235.  
  1236. }
  1237. updateData()
  1238. }
  1239. }
  1240. /**
  1241. * Generating new seed pair for client and hash server.
  1242. */
  1243. async function generateSeed() {
  1244. try {
  1245. const { server_seed_hash } = await engine.newSeedPair()
  1246. if (ex.advanced_log == true) {
  1247. engine.log(`Server hash: ${server_seed_hash}`)
  1248. }
  1249. }
  1250. catch (e) {
  1251. engine.log(`Seed is already was reset`)
  1252. }
  1253. try {
  1254. const clientSeed = randomSeed()
  1255. await engine.setClientSeed(clientSeed)
  1256. nonce = 0
  1257. if (ex.advanced_log == true) {
  1258. engine.log(`Seed was set to: ${clientSeed}`)
  1259. }
  1260. }
  1261. catch (e) {
  1262. engine.log(`Client seed already is used`)
  1263. }
  1264. }
  1265. /**
  1266. * Returns a random word for seed generation.
  1267. */
  1268. function randomSeed() {
  1269. const words = [ 'aAld35gheidfra ', 'aBragvif3hfd5n ', 'aCh5a6idr3rfdlik ', 'aDelf56fhriadgo ', 'aZ6erfchfi5hso ', 'a6Fgdfeihxft5romb ', 'agHogti56felshsa ', 'aGndhgi6mg636fu5s ', 'aAdddg5ihgc336ted ', 'aAu5d5gh6frelia ', 'aZifg2556dgalo ', 'aWive65gm66fdda ',
  1270. 'aMarid5d6fniger ', 'aOctober3idd5gffhfest ', 'aNd5radfi6shcar ', 'aPdd5aiff3ghpaja ', 'aAlbfe6hgf5idds ', 'aGfgohi6fdm5us ', 'aFigih6fgrra ', 'aGT5gg66d6i6ffdO ', 'aUn5dgh6i6ciog6frn ', 'agVicdnfg6h6t5uis ', 'aShig55diski ', 'aXda6v6gf25ier ', 'aPoigd666upfldd5et ', 'aAdntu66tdgssfulika2 ' ]
  1271.  
  1272. return words[ Math.floor(words.length * Math.random()) ] + words[ Math.floor(words.length * Math.random()) ] + words[ Math.floor(words.length * Math.random()) ]
  1273. }
  1274. /**
  1275. * Play sound peak.
  1276. */
  1277. async function gong() {
  1278. const audio = new Audio("https://bustadice.com/5bb187b7ef764e76fb519939f77288c1.mp3")
  1279. if (ex.game_sounds != false) { await audio.play() }
  1280. return new Promise(resolve => audio.onended = resolve)
  1281. }
  1282.  
  1283. async function sleep(ms = ex.interval_rolls) {
  1284. if (ms != 0) {
  1285. return new Promise(resolve => setTimeout(resolve, ms))
  1286. }
  1287. }
  1288. function reset_bets() {
  1289. for (let i = 0; i < game_array.length; i++) {
  1290. game_array[ i ].bet = game_array[ i ].basebet
  1291. }
  1292. }
  1293. function setSeed_rules() {
  1294. if (RISK_FACTOR == 0) {
  1295. change_seed_next = change_seed_next_noSTW
  1296. } else {
  1297. change_seed_next = change_seed_next_STW
  1298. }
  1299. }
  1300. async function normal_betting() {
  1301. const { multiplier } = await analyzeBet()
  1302. TOTAL_BETS++
  1303.  
  1304. nonce++
  1305. if (nonce >= change_seed_next) {
  1306. await generateSeed()
  1307. nonce = 0
  1308. }
  1309. updateStreaks(multiplier)
  1310. updateLog()
  1311. if (skipStep == 0) {
  1312. if (multiplier > 1.00) {
  1313. PROFIT += 0.01
  1314. } else {
  1315. PROFIT -= 1
  1316. }
  1317. }
  1318. }
  1319. async function fast_betting() {
  1320. if (queue.length < queueSize) {
  1321. for (let i = 0, m = queueSize - queue.length; i < m; i++) {
  1322. queue.push(fastBet());
  1323. }
  1324. }
  1325. let results = [];
  1326. await Promise.all(queue.map(p => p.catch(e => e))).then(result => result.forEach(r => results.unshift(r))).catch(e => engine.log(e));
  1327. results.forEach(async (result) => {
  1328. TOTAL_BETS++
  1329. if (result.value) {
  1330. if (result.multiplier > 1.00) {
  1331. PROFIT += 0.01;
  1332. } else {
  1333. PROFIT -= 1;
  1334. }
  1335. }
  1336. nonce++
  1337. if (nonce >= change_seed_next) {
  1338. await generateSeed()
  1339. nonce = 0
  1340. }
  1341. await updateStreaks(result.multiplier);
  1342. updateLog();
  1343. });
  1344. queue = [];
  1345. }
  1346. var arr = {
  1347. max: function(array) {
  1348. return Math.max.apply(null, array);
  1349. },
  1350.  
  1351. min: function(array) {
  1352. return Math.min.apply(null, array);
  1353. },
  1354.  
  1355. range: function(array) {
  1356. return arr.max(array) - arr.min(array);
  1357. },
  1358.  
  1359. midrange: function(array) {
  1360. return arr.range(array) / 2;
  1361. },
  1362.  
  1363. sum: function(array) {
  1364. var num = 0;
  1365. for (var i = 0, l = array.length; i < l; i++) num += array[i];
  1366. return num;
  1367. },
  1368.  
  1369. mean: function(array) {
  1370. return arr.sum(array) / array.length;
  1371. },
  1372.  
  1373. median: function(array) {
  1374. array.sort(function(a, b) {
  1375. return a - b;
  1376. });
  1377. var mid = array.length / 2;
  1378. return mid % 1 ? array[mid - 0.5] : (array[mid - 1] + array[mid]) / 2;
  1379. },
  1380.  
  1381. modes: function(array) {
  1382. if (!array.length) return [];
  1383. var modeMap = {},
  1384. maxCount = 1,
  1385. modes = [array[0]];
  1386.  
  1387. array.forEach(function(val) {
  1388. if (!modeMap[val]) modeMap[val] = 1;
  1389. else modeMap[val]++;
  1390.  
  1391. if (modeMap[val] > maxCount) {
  1392. modes = [val];
  1393. maxCount = modeMap[val];
  1394. }
  1395. else if (modeMap[val] === maxCount) {
  1396. modes.push(val);
  1397. maxCount = modeMap[val];
  1398. }
  1399. });
  1400. return modes;
  1401. },
  1402.  
  1403. variance: function(array) {
  1404. var mean = arr.mean(array);
  1405. return arr.mean(array.map(function(num) {
  1406. return Math.pow(num - mean, 2);
  1407. }));
  1408. },
  1409.  
  1410. standardDeviation: function(array) {
  1411. return Math.sqrt(arr.variance(array));
  1412. },
  1413.  
  1414. meanAbsoluteDeviation: function(array) {
  1415. var mean = arr.mean(array);
  1416. return arr.mean(array.map(function(num) {
  1417. return Math.abs(num - mean);
  1418. }));
  1419. },
  1420.  
  1421. zScores: function(array) {
  1422. var mean = arr.mean(array);
  1423. var standardDeviation = arr.standardDeviation(array);
  1424. return array.map(function(num) {
  1425. return (num - mean) / standardDeviation;
  1426. });
  1427. }
  1428. };
  1429.  
  1430. async function strategy_median(game_strategy){
  1431. while (true) {
  1432. this.log("lostcount " +lostcount)
  1433. if(lostcount < 4){
  1434. var mult = await engine.bet(100,1.01);
  1435.  
  1436. if(mult["multiplier"] < 1.5){
  1437. lostcount++;
  1438. }
  1439. else{
  1440. lostcount=0;
  1441. }
  1442. }
  1443.  
  1444. if(lostcount >= 4){
  1445. checkConditions()
  1446. engine.log(cargo)
  1447.  
  1448. let a = Math.round(engine.balance / 100) / PERCENT
  1449. let percent_b = Math.round(a / 100) * 100
  1450.  
  1451. const { multiplier } = await engine.bet(bet, target + ADDITIONAL)
  1452.  
  1453. if (multiplier < target){ // Loss
  1454. bet *= 2
  1455. }else{ // Won
  1456. bet = basebet
  1457. }
  1458. update_median(multiplier)
  1459. }
  1460. }
  1461. }
  1462.  
  1463. var basebet = 100
  1464. var bet = basebet
  1465. var queue_median = 10
  1466. var lostcount = 0
  1467.  
  1468. function update_median(multiplier) {
  1469. if (cargo.length >= queue_median){
  1470. cargo = []
  1471. }
  1472. cargo.push(multiplier)
  1473. target = arr.median(cargo)
  1474. if (target <= 1.5){
  1475. target = 1.5
  1476. bet *= 2
  1477. }
  1478. }
  1479. function checkConditions() {
  1480. if (engine.balance / 100 >= balances / 100 + 200) {
  1481. engine.log(`You reached target profit of 500!`);
  1482. lostcount=0;
  1483. balances=engine.balance
  1484.  
  1485.  
  1486. }
  1487. if (engine.balance / 100 <= balances / 100 - 500) {
  1488. engine.log(`Your balance lose limit 500, was reached. Stopping script`)
  1489. lostcount=0
  1490. balances=engine.balance
  1491.  
  1492. }
  1493. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement