Advertisement
Guest User

Untitled

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