Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 */
- var RISK_MULTIPLIER = 0.01 /* Overall change for all bets size after lose bet */
- var RISK_BASE = 1 /* Overall change for all targets base bet by multiple it, for now all targets starting with basebet = 1 */
- var minProfit = -15000 /* max lose before stop: -2061773 -4072030 */
- var maxProfit = 3000 /* max profit before stop */
- var change_seed_next_STW = 30000
- var change_seed_next_noSTW = 5000
- var setup = 7 /* Preset selector */
- /**
- * 1 - Create randomized targets, with random bets, turns, stws
- * 2 - Segmentar for 9.44 with 8 max turns and 8 stw and high various Math.pow
- * 3 - Segmentar for 9.44 with 8 max turns and 8 stw
- * 4 - Segmentar for 9.44 with return to base
- * 5 - Segmentar for 9.44 with memory, insanity risk for crazy profit
- * 6 - Many high targets
- * 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
- * 8 - 4.72x 9.09x 15x 30x 60x 19x 25x 9.44x 50x 12x 8.4x 5.4x
- * 9 - Single 5x play
- * 10 - Segmentar 9.44x, Math.pow 2.72 and configurated OP
- * 11 - 9.44x 15x 25x with max turns and semi-memoryzed targets
- * 12 - Testing OP(20k required)
- * 13 - Super-OP with incredible multiplier for second target and high bet size for both (1 BTC required)
- * 14 - soft-OP 2 targets of 9.44, high multiplier for second target
- * 15 - soft-OP 4 targets of 9.44 and various multipliers from low to high
- * 16 - soft-OP Math.pow 2.4 6 targets of 9.44
- * 17 - 3 targets playing, normal mode
- * 18 - [2.36x, 4.72x 9.44x safety] [250.000 bits bankroll]
- * 19 - [2.36x, 4.72x 9.44x 15x 30x 60x safety] [2 BTC bankroll]
- * 20 - [2.36x, 4.72x 9.44x 15x 30x 60x safety] [4 BTC bankroll]
- * 21 - [5x plays in 3 ranges]
- */
- var HIT_MIN_PROFIT_TIMES = 1 /* Moving stop, after reach minProfit X times it will reset script, 0 to disable */
- var HIT_MAX_PROFIT_TIMES = 12 /* Moving profit reacher, when hit maxProfit, do reset profit, so you don't risk it, 0 to disable */
- const LONGEST_DIFFCULTY = 14 /* STW calculated based on this formula */
- const PLAY_IN_RANGE = 4 /* Seed numbers has 4 distances, early, mid, late, extra late */
- var ex = { /* Global settings to game */ /*(990000 / ( 100 * (multiplier + 0.01) * 100 - 1))*/
- mul_target: 1.0,
- reset_all_after_win: false, /* Reset all memory bets to base bets after one of targets has won */
- increase_STW_by_same_targets: false, /* Increases STW by one with same target and STW amount */
- reset_STW_after_game_pass: true,
- disable_target_at_bust: false, /* Make current playing target at bust go offline till it ressurect's */
- increasing_bets_at_peak: false,
- bankroll_settings: false, /* Use bankroll size determinated by user balance, needed for run 250k 2btc and 4btc */
- advanced_log: false,
- game_sounds: true,
- calculate_base: false, /* TODO, feature for auto calculate safety bet size based on your balance and choose STW for each multi */
- interval_rolls: 0, /* Pause between rolls */
- nyan_hunting: {
- enabled: true,
- sessionProfit: 500000, /* Amount in bits to risk while chase high multipliers */
- sessionBet: 1000, /* Amount to bet while chasing high multipliers */
- sessionTarget: 1000, /* Target and higher session profit being to be applied */
- },
- hard_style: {
- enabled: false,
- max_loss: -25000,
- multiplier: 0.08,
- streak_range: 2,
- },
- fast_betting: {
- enabled: false,
- chase: 1.01,
- multiplier: 1.01,
- }
- }
- var arr = {
- max: function(array) {
- return Math.max.apply(null, array);
- },
- min: function(array) {
- return Math.min.apply(null, array);
- },
- range: function(array) {
- return arr.max(array) - arr.min(array);
- },
- midrange: function(array) {
- return arr.range(array) / 2;
- },
- sum: function(array) {
- var num = 0;
- for (var i = 0, l = array.length; i < l; i++) num += array[i];
- return num;
- },
- mean: function(array) {
- return arr.sum(array) / array.length;
- },
- median: function(array) {
- array.sort(function(a, b) {
- return a - b;
- });
- var mid = array.length / 2;
- return mid % 1 ? array[mid - 0.5] : (array[mid - 1] + array[mid]) / 2;
- },
- modes: function(array) {
- if (!array.length) return [];
- var modeMap = {},
- maxCount = 1,
- modes = [array[0]];
- array.forEach(function(val) {
- if (!modeMap[val]) modeMap[val] = 1;
- else modeMap[val]++;
- if (modeMap[val] > maxCount) {
- modes = [val];
- maxCount = modeMap[val];
- }
- else if (modeMap[val] === maxCount) {
- modes.push(val);
- maxCount = modeMap[val];
- }
- });
- return modes;
- },
- variance: function(array) {
- var mean = arr.mean(array);
- return arr.mean(array.map(function(num) {
- return Math.pow(num - mean, 2);
- }));
- },
- standardDeviation: function(array) {
- return Math.sqrt(arr.variance(array));
- },
- meanAbsoluteDeviation: function(array) {
- var mean = arr.mean(array);
- return arr.mean(array.map(function(num) {
- return Math.abs(num - mean);
- }));
- },
- zScores: function(array) {
- var mean = arr.mean(array);
- var standardDeviation = arr.standardDeviation(array);
- return array.map(function(num) {
- return (num - mean) / standardDeviation;
- });
- }
- };
- var description = ``
- /**
- * Syntax to use game_array.push(new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base))
- * @param set_return_to_base(true)
- * @param turn_max_bet_in_turns(false)
- * @param get_multiplier(target)
- * @param get_formula_multiplier(target)
- * @param get_stw(target)
- * @param get_random()
- * @param turn_all_strategies(false)
- * @param kill_strategy(game_type)
- */
- async function load_pattern() {
- delete_strategies()
- let cost = ``
- let listing = ``
- let sectors = 8
- let multipliers = 1.1165 + RISK_MULTIPLIER
- let targets = 9.44 * ex.mul_target
- let STWS = 0
- let turns = 0
- game_array = []
- switch (setup) {
- case 1:
- description = `Create randomized targets, with random bets, turns, stws`
- ex.disable_target_at_bust = true
- ex.increase_STW_by_same_targets = false
- ex.increasing_bets_at_peak = true
- ex.reset_STW_after_game_pass = false
- ex.reset_all_after_win = true
- for (let i = 1; i < sectors; i++) {
- let rnd_bet = 5
- let rnd_target = 16
- let rnd_turn = 5
- let temp = get_random(1.2) * rnd_target
- 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))
- }
- do_sort_random()
- break;
- case 2:
- description = `Segmentar for 9.44 with 8 max turns and 8 stw and high various Math.pow`
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.6), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.8), 6, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.4), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.7), 6, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.1), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.3), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.5), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(1 * RISK_BASE, 2.72), 6, 8, multipliers))
- break;
- case 3:
- description = `Segmentar for 9.44 with 8 max turns and 8 stw`
- game_array.push(new Strategy(targets, Math.pow(5, 2.72), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(6, 2.72), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(7, 2.72), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(8, 2.72), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(9, 2.72), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(10, 2.72), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(11, 2.72), 8, 8, multipliers))
- game_array.push(new Strategy(targets, Math.pow(12, 2.72), 8, 8, multipliers))
- break;
- case 4:
- description = `Segmentar for 9.44 with return to base`
- game_array.push(new Strategy(targets, 1, 8, 8, 1.14, true))
- game_array.push(new Strategy(targets, 5, 7, 8, 1.14, true))
- game_array.push(new Strategy(targets, 8, 8, 8, 1.14, true))
- game_array.push(new Strategy(targets, 10, 14, 16, 1.14, true))
- game_array.push(new Strategy(targets, 14, 8, 24, 1.135, true))
- game_array.push(new Strategy(targets, 19, 12, 24, 1.135, true))
- game_array.push(new Strategy(targets, 25, 12, 24, 1.15, true))
- game_array.push(new Strategy(targets, 33, 8, 24, 1.15, true))
- break;
- case 5:
- description = `Segmentar for 9.44 with memory, insanity risk for crazy profit`
- game_array.push(new Strategy(9.44, 100, 22, 1, 1.119, false))
- game_array.push(new Strategy(9.44, 307, 22, 2, 1.5, false))
- game_array.push(new Strategy(9.44, 1270, 22, 3, 1.75, false))
- game_array.push(new Strategy(9.44, 6113, 22, 4, 1.99, false))
- break;
- case 6:
- description = `Many high targets`
- for (let i = 1; i < sectors; i++) {
- game_array.push(new Strategy(i * 50, 1))
- }
- for (let i = 1; i < 3; i++) {
- game_array.push(new Strategy(i * 10000, 1))
- }
- for (let i = 1; i < 11; i++) {
- game_array.push(new Strategy(i * 1.5, 1, i * 1.5))
- }
- break;
- case 7:
- description = `4.72x 9.09x 15x 30x 60x 19x 25x 9.44x 50x 12x 8.4x 5.4x with limited max turns`
- game_array.push(new Strategy(4.72, 1, 10, get_stw(4.72), get_formula_multiplier(4.72), false))
- game_array.push(new Strategy(9.09, 1, 15, get_stw(9.09), get_formula_multiplier(9.09), false))
- game_array.push(new Strategy(15, 1, 30, get_stw(15), get_formula_multiplier(15), false))
- game_array.push(new Strategy(30, 1, 40, get_stw(30), get_formula_multiplier(30), false))
- game_array.push(new Strategy(60, 1, 40, get_stw(60), get_formula_multiplier(60), false))
- game_array.push(new Strategy(19, 1, 30, get_stw(19), get_formula_multiplier(19), false))
- game_array.push(new Strategy(25, 1, 30, get_stw(25), get_formula_multiplier(25), false))
- game_array.push(new Strategy(9.44, 1, 13, get_stw(9.44), get_formula_multiplier(9.44), false))
- game_array.push(new Strategy(50, 1, 25, get_stw(50), get_formula_multiplier(50), false))
- game_array.push(new Strategy(12, 1, 15, get_stw(12), get_formula_multiplier(12), false))
- game_array.push(new Strategy(8.4, 1, 12, get_stw(8.4), get_formula_multiplier(8.4), false))
- game_array.push(new Strategy(5.4, 1, 10, get_stw(5.4), get_formula_multiplier(5.4), false))
- game_array.push(new Strategy(70, 1, 25, get_stw(70), get_formula_multiplier(70), false))
- game_array.push(new Strategy(80, 1, 20, get_stw(80), get_formula_multiplier(80), false))
- game_array.push(new Strategy(100, 1, 15, get_stw(100), get_formula_multiplier(100), false))
- game_array.push(new Strategy(200, 1, 25, get_stw(200), get_formula_multiplier(200), false))
- updateData(0)
- do_sort_incremental()
- break;
- case 8:
- description = `4.72x 9.09x 14.36x 30x 60x 19x 25x 7.07x 50x 12x 8.4x 5.4x`
- game_array.push(new Strategy(4.72, 1, 20))
- game_array.push(new Strategy(9.09, 1, 8))
- game_array.push(new Strategy(14.36, 1, 37))
- game_array.push(new Strategy(30, 1, 20))
- game_array.push(new Strategy(60, 1, 15))
- game_array.push(new Strategy(19, 1, 8))
- game_array.push(new Strategy(25, 1, 8))
- game_array.push(new Strategy(7.07, 1, 5))
- game_array.push(new Strategy(50, 1, 10))
- game_array.push(new Strategy(12, 1, 10))
- game_array.push(new Strategy(8.4, 1, 6))
- game_array.push(new Strategy(5.4, 1, 5))
- turn_max_bet_in_turns(false)
- //game_array.push(new Strategy(14.36, 2, 37, get_stw(14.36),1.16,true))
- updateData(0)
- do_sort_incremental()
- break;
- case 9:
- description = `Single 5x play`
- game_array.push(new Strategy(5, 1, 60, 0, 1.27, true))
- break;
- case 10:
- description = `Segmentar 9.44x, Math.pow 2.72 and configurated OP`
- ex.disable_target_at_bust = false
- ex.increase_STW_by_same_targets = false
- ex.increasing_bets_at_peak = false
- ex.reset_STW_after_game_pass = false
- ex.reset_all_after_win = true
- for (let i = 1; i < 6; i++) {
- game_array.push(new Strategy(9.44, Math.pow(i, 2.72), 53 - (i * 3), 9 * i, get_formula_multiplier(9.44), true))
- }
- //turn_max_bet_in_turns(false)
- break;
- case 11:
- description = `9.44x 15x 25x with max turns and semi-memoryzed targets`
- ex.disable_target_at_bust = false
- ex.increasing_bets_at_peak = false
- ex.reset_STW_after_game_pass = true
- ex.increase_STW_by_same_targets = false
- ex.reset_all_after_win = false
- game_array.push(new Strategy(25, Math.pow(1, 2.72), 50, 52, get_formula_multiplier(25), false))
- game_array.push(new Strategy(15, Math.pow(1, 2.72), 25, 26, get_formula_multiplier(15), false))
- game_array.push(new Strategy(9.44, Math.pow(1, 2.72), 25, 10, get_formula_multiplier(9.44), true))
- turn_max_bet_in_turns(true)
- break;
- case 12:
- description = `OP testing`
- game_array.push(new Strategy(9.44, Math.pow(1, 2.2), 25, 0, get_formula_multiplier(9.44), false))
- game_array.push(new Strategy(5, Math.pow(1, 2), 22, 0, get_formula_multiplier(5), true))
- game_array.push(new Strategy(5, Math.pow(3, 2.2), 22, 0, get_formula_multiplier(3), true))
- game_array.push(new Strategy(5, Math.pow(1, 2), 22, 0, get_formula_multiplier(4), true))
- break;
- case 13:
- description = `Super-OP with incredible multiplier for second target and high bet size for both`
- cost = `1 BTC bankroll`
- game_array.push(new Strategy(9.44, 100, 22, 0, 1.12, false))
- game_array.push(new Strategy(9.44, 308, 22, 0, 1.5, false))
- break;
- case 14:
- description = `soft-OP 2 targets of 9.44, high multiplier for second target`
- game_array.push(new Strategy(9.44, 1, 22, 0, 1.09, true))
- game_array.push(new Strategy(9.44, 3, 22, 0, 1.3, true))
- break;
- case 15:
- description = `soft-OP 4 targets of 9.44 and various multipliers from low to high`
- game_array.push(new Strategy(9.44, 5, 22, 0, 1.12, true))
- game_array.push(new Strategy(9.44, 5, 22, 0, 1.3, true))
- game_array.push(new Strategy(9.44, 15, 22, 0, 1.18, true))
- game_array.push(new Strategy(9.44, 30, 22, 0, 1.15, true))
- break;
- case 16:
- description = `soft-OP Will RIP Bustadice soon, its version 2`
- ex.reset_STW_after_game_pass = false
- ex.reset_all_after_win = true
- for (let i = 1; i < OP.Loops; i++) {
- 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))
- 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))
- }
- /*for (let i = 1; i < 16; i++) {
- // 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
- game_array.push(new Strategy(9.44, Math.pow(i,2.72), 8, 11*i, get_formula_multiplier(9.44),true))
- }*/
- break;
- case 17:
- description = `Standart playing with targets: 4.32x, 7.07x and 13.5x`
- game_array.push(new Strategy(4.32, 1, 8))
- game_array.push(new Strategy(7.07, 1, 8))
- game_array.push(new Strategy(13.5, 1, 9))
- updateData(0)
- turn_max_bet_in_turns(false)
- do_sort_incremental()
- break;
- case 18:
- description = `2.36x, 4.72x 9.44x safety`
- cost = `250.000 bits bankroll`
- game_array.push(new Strategy(2.36, 5))
- game_array.push(new Strategy(4.72, 4))
- game_array.push(new Strategy(9.44, 2))
- //game_array.push(new Strategy(15, 1))
- //game_array.push(new Strategy(30, 1))
- //game_array.push(new Strategy(60, 1))
- break;
- case 19:
- description = `2.36x, 4.72x 9.44x 15x 30x 60x safety`
- cost = `2 BTC bankroll`
- game_array.push(new Strategy(2.36, 22))
- game_array.push(new Strategy(4.72, 12))
- game_array.push(new Strategy(9.44, 3))
- game_array.push(new Strategy(15, 1))
- game_array.push(new Strategy(30, 1))
- game_array.push(new Strategy(60, 16))
- //game_array.push(new Strategy(100, 2))
- break;
- case 20:
- description = `2.36x, 4.72x 9.44x 15x 30x 60x safety`
- cost = `4 BTC bankroll`
- game_array.push(new Strategy(2.36, 22))
- game_array.push(new Strategy(4.72, 30))
- game_array.push(new Strategy(9.44, 4))
- game_array.push(new Strategy(15, 12))
- game_array.push(new Strategy(30, 3))
- game_array.push(new Strategy(60, 8))
- //game_array.push(new Strategy(100, 2))
- break;
- case 21:
- description = `5x plays in 3 seed diffculty ranges`
- ex.reset_STW_after_game_pass = false
- game_array.push(new Strategy(5, 1, 13, 13, get_formula_multiplier(5), true))
- game_array.push(new Strategy(5, 15, 13, 26, get_formula_multiplier(5), true))
- game_array.push(new Strategy(5, 100, 13, 39, get_formula_multiplier(5), true))
- break;
- case 22:
- description = `Median formula in use`
- game_array.push(new Strategy(5, 1, 0, 13, get_formula_multiplier(5), true))
- game_array[0].ACTION = async function () { await strategy_median(this) };
- for (let i = 1; i <= queue; i++){
- const { multiplier } = await engine.skip()
- cargo.push(multiplier)
- }
- break;
- default:
- for (let i = 1; i < game_array.length; i++) {
- game_array.push(new Strategy(targets, i, 8, 9 * i, get_formula_multiplier(targets), true))
- }
- }
- engine.log(`Setup [${setup}] [${description}] [${cost}] being initialized.`)
- await sleep(1500)
- engine.log(`There is list of ${game_array.length} strategies will play:`)
- await sleep(1500)
- let arr_tar = []
- for (let i = 0; i < game_array.length; i++) {
- listing = listing + `${game_array[ i ].target}x, `
- arr_tar.push(game_array[i].target)
- }
- engine.log(arr.median(arr_tar))
- engine.log(listing)
- await sleep(2500)
- //updateData(RISK_FACTOR)
- }
- function set_return_to_base(isOn = false) {
- if (isOn == true) {
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].RETURN_BASE = true
- }
- } else {
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].RETURN_BASE = false
- }
- }
- }
- function turn_max_bet_in_turns(Enabled = false) {
- if (Enabled == true) {
- for (let i = 0; i < game_array.length; i++) {
- if (game_array[ i ].target == 2.36) {
- game_array[ i ].MAX_BET_TURNS = 4
- } else if (game_array[ i ].target == 4.72) {
- game_array[ i ].MAX_BET_TURNS = 22
- } else if (game_array[ i ].target == 9.44) {
- game_array[ i ].MAX_BET_TURNS = 35
- } else if (game_array[ i ].target == 15) {
- game_array[ i ].MAX_BET_TURNS = 60
- } else if (game_array[ i ].target == 30) {
- game_array[ i ].MAX_BET_TURNS = 60
- } else if (game_array[ i ].target == 60) {
- game_array[ i ].MAX_BET_TURNS = 90
- } else if (game_array[ i ].target == 100) {
- game_array[ i ].MAX_BET_TURNS = 100
- }
- }
- } else {
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].MAX_BET_TURNS = 0
- }
- }
- }
- var bet_levels_hard_hit_mod = { /* HARD_STYLE TABLE for maximum profit, ps not using it anymore */
- T2_36: { base: 26, prev: 2 },
- T4_72: { base: 12, prev: 2 },
- T9_44: { base: 3, prev: 3 },
- T15: { base: 1, prev: 1 },
- T30: { base: 1, prev: 1 },
- T60: { base: 16, prev: 6 },
- T100: { base: 6, prev: 1 },
- }
- /* New config for easy access 16th strategy, which will rip bustadice soon */
- var OP = {
- Loops: 6,
- Target_High: {
- target: 9.44,
- multiplier: get_formula_multiplier(9.44),
- exponential: 2.2,
- max_turns: 5,
- },
- Target_Low: {
- target: 4.72,
- multiplier: get_formula_multiplier(4.72),
- exponential: 2.4,
- max_turns: 6,
- },
- }
- /* TODO, undone yet */
- async function check_multiplier(basebet, multiplier, turns) {
- let expression = basebet
- let result = engine.balance / 100
- let FOUND = false
- let step = 0
- let prevesious_result = 0
- let cost = 0
- let turns_output
- if (turns != undefined) {
- turns_output = `TURNS [${turns}]`
- } else {
- turns_output = ``
- }
- engine.log(`-- Starting calculation -- BASEBET [${expression}] MULTIPLIER [${multiplier}] ` + turns_output)
- await sleep(200)
- while (!FOUND) {
- step++
- if (turns != undefined) {
- if (turns >= step) {
- FOUND = true
- engine.log(`${turns}`)
- await sleep(1000)
- }
- }
- await sleep(50)
- prevesious_result = expression
- expression = expression * multiplier
- engine.log(`${Math.round(expression)} * ${multiplier} = ${Math.round(expression) * multiplier}`)
- cost = cost + expression
- if (cost >= result) {
- cost = cost - expression
- expression = expression - prevesious_result
- step--
- FOUND = true
- engine.log(`Result: ${Math.round(cost)} Turn: ${step}`)
- await sleep(3000)
- }
- engine.log(`Wager ${Math.round(expression)} Turn ${step}`)
- }
- return Math.round(expression)
- }
- function math_cost(game_type) {
- let cost = 0
- let result = 0
- let bet_size = game_type.basebet
- let balance = engine.balance / 100
- let turns = 0
- while (cost < balance) {
- turns++
- bet_size = bet_size * game_type.multiplier
- cost = cost + bet_size
- engine.log(`${turns}, bet ${Math.round(bet_size)}, cost ${Math.round(cost)} bits`)
- }
- return result, cost, turns, bet_size
- }
- async function calculate_bankroll() {
- for (let i = 0; i < game_array.length; i++) {
- engine.log(`Calculating bets for ${game_array[ i ].target}x, base bet ${game_array[ i ].basebet}`)
- engine.log(`${game_array[ i ].target}x, mul ${game_array[ i ].multiplier.toFixed(4)}`)
- let balance = engine.balance / 100
- let turns = 0
- let start_bet_size = game_array[ i ].basebet
- let bet_size = start_bet_size
- let cost = start_bet_size
- let longest = Math.round(game_array[ i ].target * LONGEST_DIFFCULTY)
- let STW = 0
- while (turns + STW < longest) {
- turns++
- //engine.log(`${turns}, bet ${Math.round(bet_size)}, cost ${Math.round(cost)} bits`)
- bet_size *= game_array[ i ].multiplier
- cost = cost + bet_size
- if (cost > balance) {
- turns--
- STW++
- cost = cost - bet_size
- //STW = longest - turns
- start_bet_size = start_bet_size - 1
- if (start_bet_size <= 0) {
- start_bet_size = 1
- STW = Math.round(STW + (longest / 4 / 4))
- }
- //await sleep(500)
- if (turns + STW < longest) {
- //start_bet_size = start_bet_size + 1
- bet_size = start_bet_size
- turns = 0
- cost = 0
- // await engine.stop()
- //continue
- } else {
- engine.log(`Solution found`)
- game_array[ i ].bet = start_bet_size
- game_array[ i ].basebet = start_bet_size
- //return
- //engine.log(`OK safe enough now with ${STW} STW`)
- //return
- }
- } else {
- game_array[ i ].STW = STW
- game_array[ i ].bet = start_bet_size
- game_array[ i ].basebet = start_bet_size
- }
- 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}`)
- }
- }
- }
- const engine = this
- let results = [];
- var bust_text = ``
- var bust_array = []
- var last_strategy = `none`
- var change_seed_next = change_seed_next_STW
- var game_array = []
- var session_value = ex.nyan_hunting.sessionProfit
- this.log('Data loaded...... OK')
- async function preload_setup_script() {
- if (ex.bankroll_settings == false) {
- } else {
- if (engine.balance / 100 <= 2000000) {
- setup = 18
- }
- if (engine.balance / 100 >= 2000000) {
- setup = 19
- }
- if (engine.balance / 100 >= 4000000) {
- setup = 20
- }
- }
- if (ex.calculate_base == true) {
- await calculate_bankroll()
- }
- setSeed_rules()
- await load_pattern()
- }
- var PLAY_HARD = false
- var STREAK_ROLL = 0
- var output_message = ``
- var notification_timeout = 5
- let skipStep = 1 /* 0 = skip | 1 = bet */
- let nonce = 0
- let PROFIT = 0
- let TOTAL_BETS = 0
- let hard_style_played = 0
- let skip_enabled = true
- let profit_times = 0
- let TOTAL_WINS = 0
- let output_msg = ``
- let queue = []
- const RISK_MULTIPLIER_DEFAULT = RISK_MULTIPLIER
- const RISK_FACTOR_DEFAULT = RISK_FACTOR
- const RISK_BASE_DEFAULT = RISK_BASE
- const queueSize = 5
- const ver = 1.3
- engine.log(`Starting to gather information script made by by Baecoin. v${ver}`)
- /* Main loop is starting from here */
- const main = async () => {
- await preload_setup_script()
- while (true) {
- await gather_information()
- for (let igo = 0; igo < game_array.length; igo++) {
- if (game_array[ igo ].enabled) {
- await game_array[ igo ].ACTION()
- }
- }
- }
- }
- /* Prevent script from lost connection to server */
- while (true) {
- try {
- await main();
- } catch (error) {
- if (error.message === "connection closed") {
- await this.log("Connection closed. Restarting script");
- continue;
- } else {
- throw error;
- }
- }
- }
- async function gather_information() {
- //await sleep(ex.interval_rolls)
- if (ex.fast_betting.enabled == true) {
- await fast_betting()
- } else if (ex.fast_betting.enabled == false) {
- await normal_betting()
- }
- }
- async function fastBet() {
- 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);
- skipStep = !skipStep;
- return result;
- }
- async function analyzeBet() {
- const result = skip_enabled ? skipStep ? await engine.bet(100, 1.01) : await engine.skip() : await engine.bet(100, 1.01);
- skipStep = !skipStep;
- return result;
- }
- /**
- * Updates STW with multipliers
- * @param multiplier Outcome of last game result.
- */
- async function updateStreaks(multiplier) {
- for (let i = 0; i < game_array.length; i++) {
- if (multiplier < game_array[ i ].target) {
- game_array[ i ].LS++
- } else if (multiplier > game_array[ i ].target) {
- game_array[ i ].LS = 0
- game_array[ i ].MISSED++
- } else {
- if (ex.reset_STW_after_game_pass == true) {
- game_array[ i ].LS = 0 // Reset all while playing
- }
- }
- }
- }
- /**
- * Sort strategies randomly, works only when RISK_FACTOR set to 0.
- */
- function do_sort_random() {
- game_array.sort(function (a, b) { return 0.5 - Math.random() });
- }
- /**
- * Sort strategies incremental in amount of target, from low to high, works only when RISK_FACTOR set to 0.
- */
- function do_sort_incremental() {
- game_array.sort(function (a, b) { return a.target - b.target });
- }
- /**
- * Sort strategies decremental in amount of target, from high to low, works only when RISK_FACTOR set to 0.
- */
- function do_sort_decremental() {
- game_array.sort(function (a, b) { return b.target - a.target });
- }
- /**
- * Sort strategies decremental by bet size in memory, from high to low, works only when RISK_FACTOR set to 0.
- */
- function do_sort_bet_size_decremental() {
- game_array.sort(function (a, b) { return b.bet - a.bet });
- }
- /**
- * Returns index for highest target value
- */
- function game_array_get_max() {
- var len = game_array.length
- var max = -Infinity;
- var position = Infinity;
- while (len--) {
- if (game_array[ len ].target > max) {
- max = game_array[ len ].target;
- position = game_array[ len ];
- }
- }
- return position;
- }
- /**
- * Returns index for lowest target value
- */
- function game_array_get_min() {
- var len = game_array.length
- var min = Infinity;
- var position = Infinity;
- while (len--) {
- if (game_array[ len ].target < min) {
- min = game_array[ len ].target;
- position = game_array[ len ];
- }
- }
- return position;
- }
- /**
- * Returns highest target value
- */
- function game_array_target_max() {
- var len = game_array.length
- var max = -Infinity;
- while (len--) {
- if (game_array[ len ].target > max) {
- max = game_array[ len ].target;
- }
- }
- return max;
- }
- /**
- * Returns lowest target value
- */
- function game_array_target_min() {
- var len = game_array.length
- var min = Infinity;
- while (len--) {
- if (game_array[ len ].target < min) {
- min = game_array[ len ].target;
- }
- }
- return min;
- }
- function bust_counter(impact) {
- if (bust_array.length >= 50) {
- bust_array = []
- bust_text = ""
- } else {
- bust_text = bust_text + " " + impact + " "
- }
- bust_array.push(impact)
- }
- async function Summary(streak_count) {
- let main_number_who_trigger = 9.44
- let current_streak = streak_count
- let STYLE_PLAY = LONGEST_DIFFCULTY / ex.hard_style.streak_range
- if (last_strategy == main_number_who_trigger && PLAY_HARD != true) {
- if (current_streak >= Math.round(main_number_who_trigger * STYLE_PLAY)) {
- if (PROFIT > 0 && ex.hard_style.enabled == true) {
- hit_hard(true)
- }
- }
- }
- if (ex.hard_style.enabled == true) {
- 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`)
- }
- STREAK_ROLL = current_streak
- }
- async function notification_update() {
- if (notification_timeout <= 0) {
- output_message = `No Status`
- notification_timeout = 5
- }
- notification_timeout--
- }
- function notification(message) {
- output_message = message
- engine.log(`${output_message}`)
- }
- function log_busting_to_console() {
- engine.log(`${output_msg}`)
- engine.log(`Script bust ${profit_times}/${HIT_MIN_PROFIT_TIMES} times, Winning ${TOTAL_WINS} times`)
- }
- function hard_style_logging() {
- let output = ``
- if (hard_style_played > 0) {
- output = `, hard style hits was ${hard_style_played} times`
- } else {
- output = ``
- }
- return output
- }
- /**
- * Updates data to values after switching features like hard play.
- */
- function updateData(UPDATED_RISK_FACTOR = RISK_FACTOR_DEFAULT) {
- if (UPDATED_RISK_FACTOR != undefined) {
- for (let i = 0; i < game_array.length; i++) {
- if (game_array[ i ].STW == 0) {
- game_array[ i ].STW = Math.round((game_array[ i ].target * ex.mul_target) * LONGEST_DIFFCULTY / PLAY_IN_RANGE * UPDATED_RISK_FACTOR)
- }
- }
- } else {
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].STW = 0
- }
- }
- }
- /**
- * Updates all output logging.
- */
- async function updateLog() {
- engine.clearLog()
- log_busting_to_console()
- engine.log(`Rolls: ${TOTAL_BETS} Seed: ${nonce}/${change_seed_next} last run Strategy ${last_strategy}x at streak ${STREAK_ROLL}` + hard_style_logging())
- engine.log(stats_show() + `Profit: ${PROFIT.toFixed(2)}`)
- if (ex.advanced_log) {
- engine.log(output_message)
- }
- if (ex.advanced_log && ex.hard_style.enabled) {
- engine.log(`Bust data: ${bust_text}`)
- if (PLAY_HARD) {
- engine.log('HARD-PLAY MODE!')
- }
- }
- }
- /**
- * Returns data as string with updated information on each multiplier.
- */
- function stats_show() {
- let output = ``
- let status = ``
- for (let i = 0; i < game_array.length; i++) {
- if (game_array[ i ].enabled == true) {
- if (ex.advanced_log) {
- 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()}`
- if (game_array[ i ].MAX_BET_TURNS > 0) { status = status + `, cycle ${game_array[ i ].CYCLES_PAST}` }
- }
- if (game_array[ i ].STW != 0) {
- output = output + `${game_array[ i ].target.toFixed(2)}x: ${game_array[ i ].LS}/${game_array[ i ].STW} | `
- } else {
- output = output + `${game_array[ i ].target.toFixed(2)}x: next bet ${Math.round(game_array[ i ].bet)} | `
- }
- } else {
- status = `Offline. ${game_array[ i ].target.toFixed(2)}x with end bet: ${game_array[ i ].bet}`
- }
- engine.log(status)
- }
- return output
- }
- function max_win_reach() {
- PROFIT = 0
- TOTAL_WINS++
- //reset_bets()
- if (HIT_MIN_PROFIT_TIMES == 0 || TOTAL_WINS >= HIT_MAX_PROFIT_TIMES) {
- engine.log(`You reached max profit limit, stopping script`)
- engine.stop()
- }
- }
- /**
- * When condition was met, do update bust counter and stop script if necessery.
- */
- async function condition_to_bust(game_strategy) {
- if (PROFIT > maxProfit) {
- max_win_reach()
- } else {
- profit_times++
- if (profit_times >= HIT_MIN_PROFIT_TIMES) {
- engine.log(`Script lost ${profit_times} times, so it is stopping`)
- engine.stop()
- } else {
- output_msg = `Script lost once more and now ${profit_times}/${HIT_MIN_PROFIT_TIMES} before stop`
- PROFIT = 0
- reset_bets()
- await generateSeed()
- if (ex.disable_target_at_bust == true) {
- kill_strategy(game_strategy)
- }
- }
- }
- }
- function do_ressurect_disabled_targets() {
- for (let i = 0; i < game_array.length; i++) {
- if (game_array[ i ].enabled == false) {
- game_array[ i ].enabled = true
- engine.log(`${game_array[ i ].target}x ressurected`)
- }
- }
- do_sort_bet_size_decremental()
- }
- function delete_strategies() {
- game_array = []
- }
- function betSize(bet) {
- return Math.round((bet * 100) / 100) * 100
- }
- function get_formula_multiplier(target) {
- return (1 / ((target * ex.mul_target) - 1) + 1) + (RISK_MULTIPLIER * (1 / ((target * ex.mul_target) - 1) + 1))
- }
- function get_longest_streak(target) {
- return Math.round((target * ex.mul_target) * LONGEST_DIFFCULTY)
- }
- function get_stw(target) {
- return Math.round(get_longest_streak(target) / PLAY_IN_RANGE * RISK_FACTOR)
- }
- function get_multiplier(target, fixit = 4) {
- return (1 / (target - 1) + 1).toFixed(fixit)
- }
- function increase_profit(game_type) {
- if (ex.nyan_hunting.enabled && game_type.target >= ex.nyan_hunting.sessionTarget) {
- session_value = ex.nyan_hunting.sessionProfit
- }
- return (betSize(game_type.bet) / 100) * (game_type.target - 1)
- }
- function decrease_profit(game_type) {
- return betSize(game_type.bet) / 100
- }
- function get_random(power = 1.5) {
- return power - Math.random()
- }
- function turn_all_strategies(isOn = true) {
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].enabled = isOn
- engine.log(`Strategy ${game_array[ i ].target} was set to ${game_array[ i ].enabled}`)
- }
- }
- function kill_strategy(game_type) {
- game_type.enabled = false
- engine.log(`Strategy ${game_type.target} was set to ${game_type.enabled}`)
- }
- function session_start(game_strategy) {
- if (ex.nyan_hunting.enabled && game_strategy.target >= ex.nyan_hunting.sessionTarget && sessionValue > 0) {
- game_strategy.bet = ex.nyan_hunting.sessionBet
- if (session_value <= 0) {
- session_value = ex.nyan_hunting.sessionProfit
- game_strategy.bet = game_strategy.basebet_default
- } else {
- session_value -= ex.nyan_hunting.sessionBet
- }
- }
- }
- async function strategy_play(game_strategy) {
- var cycles_activation = 0
- let RETRY = true
- if (game_strategy.LS < game_strategy.STW) {
- return
- }
- game_strategy.LS = 0
- game_strategy.STREAK_ROLL = 0
- game_strategy.RUNS++
- game_strategy.CYCLES_PAST++
- last_strategy = `${game_strategy.target}`
- cycles_activation = game_strategy.CYCLES_PAST
- gong()
- while (RETRY) {
- if (game_strategy.STREAK_ROLL >= game_strategy.MAX_BET_TURNS && game_strategy.MAX_BET_TURNS != 0) {
- if (game_strategy.RETURN_BASE == true) {
- game_strategy.bet = game_strategy.basebet
- }
- RETRY = false
- return
- }
- session_start(game_strategy)
- const { multiplier } = await engine.bet(betSize(game_strategy.bet), game_strategy.target)
- TOTAL_BETS++
- nonce++
- if (multiplier < game_strategy.target) { // Loose
- game_strategy.STREAK_ROLL++
- PROFIT -= decrease_profit(game_strategy)
- game_strategy.PROFIT -= decrease_profit(game_strategy)
- game_strategy.bet *= game_strategy.multiplier
- if (PROFIT - game_strategy.bet < ex.hard_style.max_loss && PLAY_HARD == true) {
- hit_hard(false)
- RETRY = false
- }
- if (game_strategy.CYCLES_PAST >= 2 && ex.increasing_bets_at_peak == true) {
- if (cycles_activation >= 2) {
- game_strategy.basebet = game_strategy.basebet * 2
- game_strategy.bet = game_strategy.basebet
- updateLog()
- cycles_activation = 0
- }
- }
- } else { // Win
- PROFIT += increase_profit(game_strategy)
- game_strategy.PROFIT += increase_profit(game_strategy)
- game_strategy.bet = game_strategy.basebet
- if (ex.increasing_bets_at_peak == true) {
- if (game_strategy.CYCLES_PAST >= 2) {
- game_strategy.basebet = game_strategy.basebet / 2
- game_strategy.bet = game_strategy.basebet
- cycles_activation = 0
- if (game_strategy.basebet < game_strategy.basebet_default) {
- game_strategy.basebet = game_strategy.basebet_default
- game_strategy.bet = game_strategy.basebet
- }
- updateLog()
- }
- }
- game_strategy.CYCLES_PAST = 0
- RETRY = false
- if (ex.reset_all_after_win == true) {
- reset_bets()
- }
- if (game_array[ 0 ].target == game_array[ game_array.length - 1 ].target && ex.increase_STW_by_same_targets == true) {
- game_strategy.STW++
- }
- //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) {
- if (PLAY_HARD == true) {
- hit_hard(false)
- }
- if (ex.reset_STW_after_game_pass == true) {
- updateStreaks(multiplier)
- }
- }
- if (ex.reset_STW_after_game_pass == false) {
- updateStreaks(multiplier)
- }
- Summary(game_strategy.STREAK_ROLL)
- updateLog()
- if (PROFIT > maxProfit || PROFIT - game_strategy.bet < minProfit) {
- RETRY = false
- condition_to_bust(game_strategy)
- }
- if (game_strategy.STREAK_ROLL > game_strategy.MAX_STREAK) {
- game_strategy.MAX_STREAK = game_strategy.STREAK_ROLL
- }
- }
- }
- /**
- * Syntax to use new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base)
- * @param {number} basebet
- * @param {float} target
- * @param {number} max_bet_turns
- * @param {number} STW
- * @param {float} multiplier
- * @param {boolean} return_base
- */
- function Strategy(target = 2, basebet = 1, max_bet_turns = 0, STW = get_stw(target), multiplier = get_formula_multiplier(target), return_base = false) {
- this.target = target;
- this.basebet = Math.round(basebet) * RISK_BASE
- this.basebet_default = Math.round(basebet) * RISK_BASE
- this.bet = Math.round(basebet) * RISK_BASE;
- this.MAX_BET_TURNS = max_bet_turns;
- this.STW = STW;
- this.multiplier = multiplier;
- this.enabled = true;
- this.RETURN_BASE = return_base;
- /* Trigger */
- this.ACTION = async function () { await strategy_play(this) };
- /* Properties */
- this.CYCLES_PAST = 0;
- this.LS = 0;
- this.PROFIT = 0;
- this.RUNS = 0;
- this.MISSED = 0;
- this.STREAK_ROLL = 0;
- this.MAX_STREAK = 0;
- }
- /**
- * Starting strategy run, should be used only when there is gurantee will be high multipliers.
- */
- function hit_hard(isEnabled) {
- if (ex.hard_style.enabled == false) {
- return
- }
- for (let i = 0; i < game_array.length; i++) {
- bet_levels_hard_hit_mod[ i ].prev = Math.round(game_array[ i ].basebet)
- }
- if (isEnabled == true) {
- PLAY_HARD = true
- hard_style_played++
- RISK_FACTOR = 0.0
- RISK_MULTIPLIER = ex.hard_style.multiplier
- updateData(RISK_FACTOR)
- for (let i = 0; i < game_array.length; i++) {
- 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))
- }
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].basebet = Math.round(bet_levels_hard_hit_mod[ i ].base * RISK_BASE)
- game_array[ i ].bet = Math.round(bet_levels_hard_hit_mod[ i ].base * RISK_BASE)
- }
- } else {
- PLAY_HARD = false
- RISK_FACTOR = RISK_FACTOR_DEFAULT
- RISK_MULTIPLIER = RISK_MULTIPLIER_DEFAULT
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].basebet = Math.round(bet_levels_hard_hit_mod[ i ].prev * RISK_BASE)
- game_array[ i ].bet = Math.round(bet_levels_hard_hit_mod[ i ].prev * RISK_BASE)
- }
- for (let i = 0; i < game_array.length; i++) {
- 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))
- }
- updateData()
- }
- }
- /**
- * Generating new seed pair for client and hash server.
- */
- async function generateSeed() {
- try {
- const { server_seed_hash } = await engine.newSeedPair()
- if (ex.advanced_log == true) {
- engine.log(`Server hash: ${server_seed_hash}`)
- }
- }
- catch (e) {
- engine.log(`Seed is already was reset`)
- }
- try {
- const clientSeed = randomSeed()
- await engine.setClientSeed(clientSeed)
- nonce = 0
- if (ex.advanced_log == true) {
- engine.log(`Seed was set to: ${clientSeed}`)
- }
- }
- catch (e) {
- engine.log(`Client seed already is used`)
- }
- }
- /**
- * Returns a random word for seed generation.
- */
- function randomSeed() {
- const words = [ 'aAld35gheidfra ', 'aBragvif3hfd5n ', 'aCh5a6idr3rfdlik ', 'aDelf56fhriadgo ', 'aZ6erfchfi5hso ', 'a6Fgdfeihxft5romb ', 'agHogti56felshsa ', 'aGndhgi6mg636fu5s ', 'aAdddg5ihgc336ted ', 'aAu5d5gh6frelia ', 'aZifg2556dgalo ', 'aWive65gm66fdda ',
- 'aMarid5d6fniger ', 'aOctober3idd5gffhfest ', 'aNd5radfi6shcar ', 'aPdd5aiff3ghpaja ', 'aAlbfe6hgf5idds ', 'aGfgohi6fdm5us ', 'aFigih6fgrra ', 'aGT5gg66d6i6ffdO ', 'aUn5dgh6i6ciog6frn ', 'agVicdnfg6h6t5uis ', 'aShig55diski ', 'aXda6v6gf25ier ', 'aPoigd666upfldd5et ', 'aAdntu66tdgssfulika2 ' ]
- return words[ Math.floor(words.length * Math.random()) ] + words[ Math.floor(words.length * Math.random()) ] + words[ Math.floor(words.length * Math.random()) ]
- }
- /**
- * Play sound peak.
- */
- async function gong() {
- const audio = new Audio("https://bustadice.com/5bb187b7ef764e76fb519939f77288c1.mp3")
- if (ex.game_sounds != false) { await audio.play() }
- return new Promise(resolve => audio.onended = resolve)
- }
- async function sleep(ms = ex.interval_rolls) {
- if (ms != 0) {
- return new Promise(resolve => setTimeout(resolve, ms))
- }
- }
- function reset_bets() {
- for (let i = 0; i < game_array.length; i++) {
- game_array[ i ].bet = game_array[ i ].basebet
- }
- }
- function setSeed_rules() {
- if (RISK_FACTOR == 0) {
- change_seed_next = change_seed_next_noSTW
- } else {
- change_seed_next = change_seed_next_STW
- }
- }
- async function normal_betting() {
- const { multiplier } = await analyzeBet()
- TOTAL_BETS++
- nonce++
- if (nonce >= change_seed_next) {
- await generateSeed()
- nonce = 0
- }
- updateStreaks(multiplier)
- updateLog()
- if (skipStep == 0) {
- if (multiplier > 1.00) {
- PROFIT += 0.01
- } else {
- PROFIT -= 1
- }
- }
- }
- async function fast_betting() {
- if (queue.length < queueSize) {
- for (let i = 0, m = queueSize - queue.length; i < m; i++) {
- queue.push(fastBet());
- }
- }
- let results = [];
- await Promise.all(queue.map(p => p.catch(e => e))).then(result => result.forEach(r => results.unshift(r))).catch(e => engine.log(e));
- results.forEach(async (result) => {
- TOTAL_BETS++
- if (result.value) {
- if (result.multiplier > 1.00) {
- PROFIT += 0.01;
- } else {
- PROFIT -= 1;
- }
- }
- nonce++
- if (nonce >= change_seed_next) {
- await generateSeed()
- nonce = 0
- }
- await updateStreaks(result.multiplier);
- updateLog();
- });
- queue = [];
- }
- var arr = {
- max: function(array) {
- return Math.max.apply(null, array);
- },
- min: function(array) {
- return Math.min.apply(null, array);
- },
- range: function(array) {
- return arr.max(array) - arr.min(array);
- },
- midrange: function(array) {
- return arr.range(array) / 2;
- },
- sum: function(array) {
- var num = 0;
- for (var i = 0, l = array.length; i < l; i++) num += array[i];
- return num;
- },
- mean: function(array) {
- return arr.sum(array) / array.length;
- },
- median: function(array) {
- array.sort(function(a, b) {
- return a - b;
- });
- var mid = array.length / 2;
- return mid % 1 ? array[mid - 0.5] : (array[mid - 1] + array[mid]) / 2;
- },
- modes: function(array) {
- if (!array.length) return [];
- var modeMap = {},
- maxCount = 1,
- modes = [array[0]];
- array.forEach(function(val) {
- if (!modeMap[val]) modeMap[val] = 1;
- else modeMap[val]++;
- if (modeMap[val] > maxCount) {
- modes = [val];
- maxCount = modeMap[val];
- }
- else if (modeMap[val] === maxCount) {
- modes.push(val);
- maxCount = modeMap[val];
- }
- });
- return modes;
- },
- variance: function(array) {
- var mean = arr.mean(array);
- return arr.mean(array.map(function(num) {
- return Math.pow(num - mean, 2);
- }));
- },
- standardDeviation: function(array) {
- return Math.sqrt(arr.variance(array));
- },
- meanAbsoluteDeviation: function(array) {
- var mean = arr.mean(array);
- return arr.mean(array.map(function(num) {
- return Math.abs(num - mean);
- }));
- },
- zScores: function(array) {
- var mean = arr.mean(array);
- var standardDeviation = arr.standardDeviation(array);
- return array.map(function(num) {
- return (num - mean) / standardDeviation;
- });
- }
- };
- async function strategy_median(game_strategy){
- while (true) {
- this.log("lostcount " +lostcount)
- if(lostcount < 4){
- var mult = await engine.bet(100,1.01);
- if(mult["multiplier"] < 1.5){
- lostcount++;
- }
- else{
- lostcount=0;
- }
- }
- if(lostcount >= 4){
- checkConditions()
- engine.log(cargo)
- let a = Math.round(engine.balance / 100) / PERCENT
- let percent_b = Math.round(a / 100) * 100
- const { multiplier } = await engine.bet(bet, target + ADDITIONAL)
- if (multiplier < target){ // Loss
- bet *= 2
- }else{ // Won
- bet = basebet
- }
- update_median(multiplier)
- }
- }
- }
- var basebet = 100
- var bet = basebet
- var queue_median = 10
- var lostcount = 0
- function update_median(multiplier) {
- if (cargo.length >= queue_median){
- cargo = []
- }
- cargo.push(multiplier)
- target = arr.median(cargo)
- if (target <= 1.5){
- target = 1.5
- bet *= 2
- }
- }
- function checkConditions() {
- if (engine.balance / 100 >= balances / 100 + 200) {
- engine.log(`You reached target profit of 500!`);
- lostcount=0;
- balances=engine.balance
- }
- if (engine.balance / 100 <= balances / 100 - 500) {
- engine.log(`Your balance lose limit 500, was reached. Stopping script`)
- lostcount=0
- balances=engine.balance
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement