Skip to content

Instantly share code, notes, and snippets.

@bustapaladin
Created May 26, 2019 13:09
Show Gist options
  • Save bustapaladin/af0240e33b90c8c0433db2420e73d9ba to your computer and use it in GitHub Desktop.
Save bustapaladin/af0240e33b90c8c0433db2420e73d9ba to your computer and use it in GitHub Desktop.
Sandbox_script_first_release by Ruzli #7111, If you liked my sandbox and want say big thanks, or want support my team, you can make donation to our team here - 1GUU7UZLAWUAA58bx9zuJiTM7eLGUoK6wi
var config = {
//******************COMMON****************** */
PASTE_CASE: { label: "Paste", type: "text", value: "Paste raw text of configuration launch" },
cb_globals: {
label: "Sandbox", type: "radio", value: "sandbox_mode", options: {
sandbox_mode: { label: "Sandbox Mode (if you set it to true will trigger below configuration to be used)", type: "noop", value: "" },
SETUP: { label: "Configuration Launch Case", type: "number", value: 0 },
merged: { label: "Run both in sandbox and confioguration launch", type: "noop", value: "" },
}
},
//******************GLOBAL****************** */
globalHeader: { label: "Global Settings (-1 = disable, 0 = auto)", type: "noop", value: "" },
RISK_FACTOR: { label: "Risk Factor (skipping amount)", type: "multiplier", value: 1.0 },
RISK_MULTIPLIER: { label: "Risk Multiplier (multiplier amount)", type: "multiplier", value: 0.0 },
RISK_BASE: { label: "Risk Base (overall base bet regulation)", type: "multiplier", value: 1.0 },
//******************BETS****************** */
sb_base_bet: { label: "Base Bet", type: "balance", value: 300 },
sb_max_bet_turns: { label: "Max Bet turns (set to -1 to play infinity amount of rolls until you hit win)", type: "number", value: 27 },
sb_stw: { label: "STW - Streak To Wait", type: "number", value: 25 },
sb_max_bk_percent: { label: "Max balance percent usage", type: "number", value: 100 },
sb_increase_bb_on_wins: { label: "Increase basebet after cycles of wins(satoshi)", type: "number", value: 20 },
sb_increase_bb_on_streak: { label: "Increase basebet after streak happen(rolls)", type: "number", value: -1 },
sb_increase_bb_times: { label: "Increase basebet amount times", type: "number", value: 20 },
cb_bets_modes: {
label: "Bet Change", type: "radio", value: "mul", options: {
mul: { label: "Bet Multiplier", type: "multiplier", value: 1.08 },
add: { label: "Static Change", type: "balance", value: 100 },
}
},
//******************TARGETS****************** */
cb_targets: {
label: "Targets", type: "radio", value: "sb_array", options: {
sb_base_target: { label: "Single Strategy", type: "number", value: 10 },
sb_array: { label: "List of Strategies", type: "text", value: " 100, 150, 100, 200, 100, 350, 100, 500, 100, 1000" }, // 3, 5, 10, 14, 19, 35, 75, 100, 250
sb_counted_array: { label: "Set generate by count of strategies", type: "number", value: 1 },
}
},
cb_target_modes: {
label:"Target Change", type: "radio", value: "mul", options: {
mul: { label: "Target Multiplier", type: "multiplier", value: 1.0 },
add: { label: "Static Change", type: "number", value: 0.30 }
}
},
//******************GAMEPLAY MODIFICATIONS****************** Gameplay modifications (-1 = Disabled, 0 = Automatic fill) */
att_mod_cc_Header: { label: "Gameplay Feature - Chain chase", type: "noop", value: "" },
sb_chain_chase: { label: "Chain chase enabled", type: "checkbox", value: false },
sb_chain_chase_queue: { label: "Chain chase queue", type: "number", value: 3 },
att_ff__betsHeader: { label: "Gameplay Feature - Fast Betting", type: "noop", value: "" },
fast_betting_enabled: { label: "Use Fast Betting", type: "checkbox", value: false },
fast_betting_chase: { label: "Target", type: "multiplier", value: 1.01 },
fast_betting_wager: { label: "Flat bets", type: "balance", value: 100 },
att_mod_median_Header: { label: "Gameplay Feature - Median", type: "noop", value: "" },
sb_median_enabled: { label: "Use Median", type: "checkbox", value: false },
sb_median_bettable: { label: "Bettable bet", type: "multiplier", value: 0.1 },
sb_median_min_cut: { label: "Min cut", type: "multiplier", value: 1.5 },
sb_median_max_cut: { label: "Max cut", type: "multiplier", value: 2.0 },
sb_median_skips: { label: "Cargo size", type: "number", value: 3 },
att_mod_pullee_Header: { label: "Gameplay Feature - Pullee", type: "noop", value: "" },
sb_pullee_enabled: { label: "Use Pullee", type: "checkbox", value: false },
sb_pullee: { label: "Target Power", type: "multiplier", value: 0.1 },
//******************CONDITIONS****************** */
conditionHeader: { label: "Condition Regulations", type: "noop", value: "" },
minProfit: { label: "Amount allow to lose", type: "balance", value: -1000000 },
maxProfit: { label: "Maximal profit", type: "balance", value: 1000000 },
//******************BETS CONDITIONS****************** */
bets_conditionHeader: { label: "Bets Conditions", type: "noop", value: "" },
sb_bets_maximal: { label: "Bet Maximal", type: "balance", value: 10000000 },
sb_bets_minimal: { label: "Bet Minimal", type: "balance", value: 100 },
sb_return_base: { label: "Return to base bet", type: "checkbox", value: true },
sb_return_on_win: { label: "Return on win", type: "checkbox", value: true },
sb_return_on_lose: { label: "Return on lose", type: "checkbox", value: false },
//******************TARGET CONDITIONS****************** */
targets_conditionHeader: { label: "Targets Conditions", type: "noop", value: "" },
sb_target_minimal: { label: "Minimal Target", type: "number", value: 1.01 },
sb_target_maximal: { label: "Maximal Target", type: "number", value: 10000 },
sb_target_return_base: { label: "Return to base target", type: "checkbox", value: false },
sb_target_return_on_win: { label: "Return on win", type: "checkbox", value: true },
sb_target_return_on_lose: { label: "Return on lose", type: "checkbox", value: false },
sb_simulation_mode: { label: "Simulation Mode", type: "checkbox", value: false },
sb_simulation_balance: { label: "Simulation Balance", type: "number", value: 100000 },
}
var RISK_FACTOR = config.RISK_FACTOR.value /* Overall change for every target. Set to 0.0 to run without Streak To Wait(STW), set 1.0(100%, i.o. normal) to run with STW feature */
var RISK_MULTIPLIER = config.RISK_MULTIPLIER.value /* Overall change for all bets size after lose bet, value is added to base multiplier for every target */
var RISK_BASE = config.RISK_BASE.value /* Overall change for all targets base bet, if value set to 1, then basebet = 1, if value set to 0.2, then basebet = 20 satoshi */
var min_Profit = config.minProfit.value /* max lose before stop. In bits */
var max_Profit = config.maxProfit.value /* max profit before stop. In bits */
var change_seed_next_STW = 100000
var change_seed = 20000
var BET_PERCENT_FROM_BK = config.sb_max_bk_percent.value /* 100 = 100%, i.o use all balance to bet size */
var FORCE_STOP_IF_LOWER = 0 /* Don't allow balance drop lower than this value. 0 to disable this feature. */
const FULL = 1, NORMAL = 0
var simulation = config.sb_simulation_mode.value
var simulation_balance = config.sb_simulation_balance.value
var simulation_MODE = NORMAL /* NORMAL - DON'T SHOW TARGET / FULL - SHOW PLACE TARGET */
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 = 1 /* Moving profit reacher, when hit maxProfit, do reset profit, so you don't risk it, 0 to disable */
const LONGEST_DIFFCULTY = 16 /* STW calculated based on this formula */
const PLAY_IN_RANGE = 4 /* Seed numbers has 4 distances, early, mid, late, extra late */
const ver = 2.0
// Alpha testing = clientSeed, gameSeed, auditSeed <- [ALPHA]
var auditSeed = "04097893aa9456880f62b29d4c52cf256935868cf50f0eae7ba9c6c02099b589"
var clientSeed = "b27cd3fe415600657a29590fb07e78e12a45075aec492061e3a52ca5c0f6057b"
var gameSeed = `glorious subdued berry`
var setup = config.cb_globals.options.SETUP.value /* Preset configuration selector */
/** Number you set must be in function load_pattern() > switch statement > case with number.
* All other cases located at link below:
* https://github.com/ruzli/script_cases
*/
var fast_loading_config = true /* Don't wait when script will launch, force it launch immediatly */
var allow_seed_reset = true /* Set rule for seed being reset only when all tactics have ended their period */
var ex = { /* Global settings to game */ /*(990000 / ( 100 * (multiplier + 0.01) * 100 - 1))*/
calculate_base: false, /* For big balances, automatically calculates effecient multiplier and STW */
analyze_streaks: true, /* STW mechanism */
winning_frequency: false, // BETA
luck_usage: false, // BETA
reset_to_first_on_hit_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, /* If tactic have memorized bets, and loses 2 full cycles, it will increase and decrease base bets */
increasing_bets_at_peak_value: 2, /* Multiply base bet on that amount */
mul_target: 1.0,
stop_on_streak_catch: false,
game_sounds: true,
interval_rolls: 0, /* Pause between rolls */
debug: false, /* Logging output enabled or disabled */
advanced_log: true, /* Logging output for more detailed information, ignores debug value */
reset_static_stats_on_launch: true, /* Reset static client stats on script launch */
session_game: {
enabled: false, /* SessionProfit will risk profit after reach this amount of overall profit */
sessionProfit: 500, /* Amount in bits to risk while chase high multipliers after accuiring that amount of overall profit */
sessionBet: 10, /* Amount to bet while chasing high multipliers after sessionProfit triggered */
sessionTarget: 5, /* Target and higher will trigger sessionProfit to start */
sessionMode: true, /* Single bet session profit or multiple */
},
hard_style: {
enabled: false,
max_loss: -25000,
multiplier: 0.08,
streak_range: 2,
},
fast_betting: {
enabled: config.fast_betting_enabled.value,
wager: config.fast_betting_wager.value,
chase: config.fast_betting_chase.value,
},
stats_logging: {
median: true,
median_cargo: 1000,
median_history: false,
},
increase_basebet_after_streak: config.sb_increase_bb_on_streak.value, // Increase basebet after reach streak amount you set in GUI
increase_basebet_on_wins: config.sb_increase_bb_on_wins.value, // Increase basebet on amount of satoshi you set each time you win unless increase_times more than 0
increase_basebet_times: config.sb_increase_bb_times.value, // Specify for streaks/wins (two values above) amount of times to repeat this, 0 to disable, more than 1 will activate it(each trigger decreases this value)
}
const engine = this
var output_features = ``
var luck_output = `` // BETA
var luck_activation = 0 // BETA
var cool_down = 10 // BETA
var last_strategy = null
var change_seed_next = change_seed_next_STW
var game_array = new Array(), patterns = new Array(), history = [], queue = [], log_history = []
var PLAY_HARD = false
var skip_enabled = true
var notification_timeout = 5
var skipStep = 1 /* 0 = skip | 1 = bet */
const queueSize = 5
var minProfit = min_Profit, maxProfit = max_Profit // Converting to satoshies
const RISK_MULTIPLIER_DEFAULT = RISK_MULTIPLIER
const RISK_FACTOR_DEFAULT = RISK_FACTOR
const RISK_BASE_DEFAULT = RISK_BASE
var nonce = 0, PROFIT = 0, TOTAL_BETS = 0, TOTAL_ROLLS = 0, TOTAL_WINS = 0, profit_times = 0,
hard_style_played = 0, WINS_OVERALL = 0, session_value = 0, STREAK_ROLL = 0
var output_message = ``, output_msg = ``
/*const origBet = this.bet;
this.bet = async function () {
return origBet.apply(this, arguments);
}*/
/* Syntax to use game_array.push(new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base)) */
async function load_pattern() {
delete_strategies()
let description = ``
let listing = ``
let cost = ``
if (config.cb_globals.value == "sandbox_mode" || config.cb_globals.value == "merged") {
description = `Sandbox mode`
engine.log(description)
await ScriptConstructorArea()
engine.log(`Reading GUI`)
await create_launch_in_console()
///await ScriptMasterizeArea(0)
}
if (config.cb_globals.value == "SETUP" || config.cb_globals.value == "merged") {
switch (config.cb_globals.options.SETUP.value) {
case 1:
ex.analyze_streaks = true;
RISK_FACTOR = 1;
RISK_MULTIPLIER = 0;
RISK_BASE = 1;
BET_PERCENT_FROM_BK = 100;
minProfit = -500000;
maxProfit = 500000;
simulation = false;
simulation_balance = 100000;
ex.increase_basebet_after_streak = -1;
ex.increase_basebet_on_wins = 0;
ex.increase_basebet_times = 0;
game_array.push(new Strategy(10, 100, 35, 7, 1.12, true));
game_array[ 0 ].target = 10;
game_array[ 0 ].basebet = 100;
game_array[ 0 ].basebet_default = 100;
game_array[ 0 ].bet = 100;
game_array[ 0 ].MAX_BET_TURNS = 35;
game_array[ 0 ].STW = 7;
game_array[ 0 ].multiplier = 1.12;
game_array[ 0 ].enabled = true;
game_array[ 0 ].Settings.bet.multiplier = 1.12;
game_array[ 0 ].Settings.bet.base = 100;
game_array[ 0 ].Settings.bet.mode = "mul";
game_array[ 0 ].Settings.bet.minimal = 100;
game_array[ 0 ].Settings.bet.maximal = 4800;
game_array[ 0 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 0 ].Settings.bet.return_at.on_win = true;
game_array[ 0 ].Settings.bet.return_at.on_lose = false;
game_array[ 0 ].Settings.target.multiplier = 1;
game_array[ 0 ].Settings.target.base = 10;
game_array[ 0 ].Settings.target.mode = "mul";
game_array[ 0 ].Settings.target.minimal = 1.01;
game_array[ 0 ].Settings.target.maximal = 10000;
game_array[ 0 ].Settings.target.return_at.return = false;
game_array[ 0 ].Settings.target.return_at.on_win = true;
game_array[ 0 ].Settings.target.return_at.on_lose = false;
break;
}
}
if (config.cb_globals.options.SETUP.value == -1) {
eval("{" + config.PASTE_CASE.value + "}")
}
if (!fast_loading_config && config.cb_globals.options.SETUP.value != 0) {
engine.log(`Setup [${setup}] [${description}] [${cost}] being initialized.`)
//await sleep(1000)
engine.log(`There is list of ${game_array.length} strategies will play:`)
//await sleep(1000)
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(listing)
//await sleep(2500)
}
}
/* Syntax to use game_array.push(new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base)) */
async function ScriptConstructorArea(){
var numArray = JSON.parse(`[${config.cb_targets.options.sb_array.value}]`);
let len = numArray
let sm_bb = config.sb_base_bet.value / 100
let sm_t = config.cb_targets.options.sb_base_target.value
let sm_mbt = config.sb_max_bet_turns.value
let sm_stw = config.sb_stw.value
let sm_mul = config.cb_bets_modes.options.mul.value
let sm_rb = config.sb_return_base.value
let sm_mode = config.cb_target_modes.value
if (sm_bb == 0) sm_bb = 1
await engine.log(`Constructing Script`)
await sleep(1600)
switch (sm_mbt) {
case -1:
sm_mbt = 0
sm_rb = true
break;
case 0:
sm_mbt = get_max_turns(sm_t)
sm_rb = false
break;
}
switch (sm_mul) {
case -1:
sm_mul = 1.0
break;
case 0:
sm_mul = get_formula_multiplier(sm_t)
break;
}
switch (sm_stw) {
case -1:
sm_stw = 0
ex.analyze_streaks = false
ex.reset_STW_after_game_pass = false
break;
case 0:
ex.analyze_streaks = true
ex.reset_STW_after_game_pass = true
sm_stw = get_stw(sm_t)
break;
case sm_stw > 0:
ex.analyze_streaks = true
ex.reset_STW_after_game_pass = true
break;
}
if (config.cb_targets.value == `sb_array`) {
for (var i = 0; i < numArray.length; i++) {
if (sm_mbt == 0) {
sm_rb = false
sm_mbt = get_max_turns(numArray[ i ])
}
if (config.sb_stw.value == 0) {
ex.analyze_streaks = true
ex.reset_STW_after_game_pass = true
sm_stw = get_stw(numArray[ i ])
}
if (config.sb_stw.value == -1) {
ex.analyze_streaks = false
ex.reset_STW_after_game_pass = false
sm_stw = 0
}
if (config.cb_bets_modes.options.mul.value < 1) { sm_mul = get_formula_multiplier(numArray[ i ]) }
game_array.push(new Strategy(numArray[ i ], sm_bb, sm_mbt, sm_stw, sm_mul, sm_rb)) /* Generate tactics */
await ScriptMasterizeArea(i)
engine.log(`sm_bb ${sm_bb}; sm_t ${numArray[ i ]}; sm_mbt ${sm_mbt}; sm_stw ${sm_stw}; sm_mul ${sm_mul}; sm_rb ${sm_rb}`)
}
}
if (config.cb_targets.value == `sb_base_target`) {
game_array.push(new Strategy(sm_t, sm_bb, sm_mbt, sm_stw, sm_mul, sm_rb)) /* Generate tactic */
await ScriptMasterizeArea(0)
engine.log(`sm_bb ${sm_bb}; sm_t ${sm_t}; sm_mbt ${sm_mbt}; sm_stw ${sm_stw}; sm_mul ${sm_mul}; sm_rb ${sm_rb}`)
await sleep(1500)
}
let isBustable = await check_bustable(clientSeed, auditSeed, gameSeed, 200, true, true, 0)
engine.log(`Bustable: ${isBustable} (full working in next version of tier 2)`)
}
async function ScriptMasterizeArea(number = 0){
/*Bet */
game_array[number].Settings.bet.base = game_array[number].basebet_default
game_array[number].Settings.bet.maximal = config.sb_bets_maximal.value
game_array[number].Settings.bet.minimal = config.sb_bets_minimal.value
game_array[number].Settings.bet.mode = config.cb_bets_modes.value // will show 'mul' or 'add' of string value
if (game_array[number].Settings.bet.mode == "mul"){
game_array[number].Settings.bet.multiplier = config.cb_bets_modes.options.mul.value
}
if (game_array[number].Settings.bet.mode == "add"){
game_array[number].Settings.bet.multiplier = config.cb_bets_modes.options.add.value
}
game_array[number].Settings.bet.return_at.RETURN_BASE = config.sb_return_base.value
game_array[number].Settings.bet.return_at.on_lose = config.sb_return_on_lose.value
game_array[number].Settings.bet.return_at.on_win = config.sb_return_on_win.value
/*Target */
game_array[number].Settings.target.base = game_array[number].target
game_array[number].Settings.target.minimal = config.sb_target_minimal.value
game_array[number].Settings.target.maximal = config.sb_target_maximal.value
game_array[number].Settings.target.mode = config.cb_target_modes.value
if (game_array[number].Settings.target.mode == "mul"){
game_array[number].Settings.target.multiplier = config.cb_target_modes.options.mul.value
}
if (game_array[number].Settings.target.mode == "add"){
game_array[number].Settings.target.multiplier = config.cb_target_modes.options.add.value
}
game_array[number].Settings.target.return_at.return = config.sb_target_return_base.value
game_array[number].Settings.target.return_at.on_win = config.sb_target_return_on_win.value
game_array[number].Settings.target.return_at.on_lose = config.sb_target_return_on_lose.value
//game_array[number].Settings.target.digits_round
/* Modifications */
game_array[number].Settings.modifications.chain_chase.enabled = config.sb_chain_chase.value
game_array[number].Settings.modifications.chain_chase.queue_base = config.sb_chain_chase_queue.value
game_array[number].Settings.modifications.median.enabled = config.sb_median_enabled.value
game_array[number].Settings.modifications.median.bet_balance = config.sb_median_bettable.value
game_array[number].Settings.modifications.median.max_cut = config.sb_median_max_cut.value
game_array[number].Settings.modifications.median.min_cut = config.sb_median_min_cut.value
game_array[number].Settings.modifications.median.skips_used_by_median = config.sb_median_skips.value
game_array[number].Settings.modifications.pullee.enabled = config.sb_pullee_enabled.value
game_array[number].Settings.modifications.pullee.power = config.sb_pullee.value
/* Triggers */
if (game_array[0].Settings.modifications.median.enabled){
ex.analyze_streaks = true
game_array[0].ACTION = await median_loop(game_array[0])
}
if (game_array[ 0 ].Settings.modifications.pullee.enabled){
ex.analyze_streaks = false
let bet_base = config.sb_bets_minimal.value
let bet_max = config.sb_bets_minimal.value
let bet_power = config.cb_bets_modes.options.mul.value
let target_base = config.sb_target_minimal.value
let target_max = config.sb_target_maximal.value
let target_power = config.sb_pullee.value
let target_pull = CreatePullee(target_base, target_base, target_max, target_power)();
let bet_pull = CreatePullee(bet_base, bet_base, bet_max, bet_power)();
game_array[ 0 ].ACTION = await strategy_pullee(bet_pull, target_pull)
}
}
async function create_launch_in_console(){
let output = ``
engine.log(`Trying make launch configuration and dump it to console(F12)`)
await sleep(500)
//output+= `case 1: `
output+= `ex.analyze_streaks = ${ex.analyze_streaks};\\n`
output+= `RISK_FACTOR = ${RISK_FACTOR};\n`
output+= `RISK_MULTIPLIER = ${RISK_MULTIPLIER};\n`
output+= `RISK_BASE = ${RISK_BASE};\n`
output+= `BET_PERCENT_FROM_BK = ${BET_PERCENT_FROM_BK};\n\n`
output+= `minProfit = ${minProfit};\n`
output+= `maxProfit = ${maxProfit};\n\n`
output+= `simulation = ${simulation};\n`
output+= `simulation_balance = ${simulation_balance};\n\n`
output+= `ex.increase_basebet_after_streak = ${ex.increase_basebet_after_streak};\n`
output+= `ex.increase_basebet_on_wins = ${ex.increase_basebet_on_wins};\n`
output+= `ex.increase_basebet_times = ${ex.increase_basebet_times};\n\n`
for (let i = 0; i < game_array.length; i++){
let gs = game_array[i]
output+= `game_array.push(new Strategy(${gs.target}, ${gs.basebet_default}, ${gs.MAX_BET_TURNS}, ${gs.STW}, ${gs.Settings.bet.multiplier}, ${gs.Settings.bet.return_at.RETURN_BASE}));\n`
}
for (let i = 0; i < game_array.length; i++){
let gs = game_array[i]
output+= `game_array[ ${i} ].target = ${gs.target};\n`
output+= `game_array[ ${i} ].basebet = ${gs.basebet};\n`
output+= `game_array[ ${i} ].basebet_default = ${gs.basebet_default};\n`
output+= `game_array[ ${i} ].bet = ${gs.bet};\n`
output+= `game_array[ ${i} ].MAX_BET_TURNS = ${gs.MAX_BET_TURNS};\n`
output+= `game_array[ ${i} ].STW = ${gs.STW};\n`
output+= `game_array[ ${i} ].multiplier = ${gs.multiplier};\n`
output+= `game_array[ ${i} ].enabled = ${gs.enabled};\n\n`
/* Object Bet Attributes || bet: multiplier, base, mode(mul/add), minimal, maximal, return_at(RETURN_BASE, on_win, on_lose) */
output+= `game_array[ ${i} ].Settings.bet.multiplier = ${gs.Settings.bet.multiplier};\n`
output+= `game_array[ ${i} ].Settings.bet.base = ${gs.Settings.bet.base};\n`
output+= `game_array[ ${i} ].Settings.bet.mode = "${gs.Settings.bet.mode}";\n`
output+= `game_array[ ${i} ].Settings.bet.minimal = ${gs.Settings.bet.minimal};\n`
output+= `game_array[ ${i} ].Settings.bet.maximal = ${gs.Settings.bet.maximal};\n`
output+= `game_array[ ${i} ].Settings.bet.return_at.RETURN_BASE = ${gs.Settings.bet.return_at.RETURN_BASE};\n`
output+= `game_array[ ${i} ].Settings.bet.return_at.on_win = ${gs.Settings.bet.return_at.on_win};\n`
output+= `game_array[ ${i} ].Settings.bet.return_at.on_lose = ${gs.Settings.bet.return_at.on_lose};\n\n`
/* Object Target Attributes || target: multiplier, base, mode(mul/add), minimal, maximal, return_at(return, on_win, on_lose) */
output+= `game_array[ ${i} ].Settings.target.multiplier = ${gs.Settings.target.multiplier};\n`
output+= `game_array[ ${i} ].Settings.target.base = ${gs.Settings.target.base};\n`
output+= `game_array[ ${i} ].Settings.target.mode = "${gs.Settings.target.mode}";\n`
output+= `game_array[ ${i} ].Settings.target.minimal = ${gs.Settings.target.minimal};\n`
output+= `game_array[ ${i} ].Settings.target.maximal = ${gs.Settings.target.maximal};\n`
output+= `game_array[ ${i} ].Settings.target.return_at.return = ${gs.Settings.target.return_at.return};\n`
output+= `game_array[ ${i} ].Settings.target.return_at.on_win = ${gs.Settings.target.return_at.on_win};\n`
output+= `game_array[ ${i} ].Settings.target.return_at.on_lose = ${gs.Settings.target.return_at.on_lose};\n`
// Missing modifications
// Missing triggers
}
//output+= `break;`
console.log(output)
engine.log(`Dump was created for launch case in console(F12)`)
}
function set_return_to_base(isOn = false) {
if (isOn == true) {
for (let i = 0; i < game_array.length; i++) {
game_array[ i ].Settings.bet.return_at.RETURN_BASE = true
}
} else {
for (let i = 0; i < game_array.length; i++) {
game_array[ i ].Settings.bet.return_at.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 },
}
function check_multiplier(balance, turns, wager = 100, precision = 5) {
let num = 0, bal = balance, mul = 1.01, last = mul;
let p = 0, inc = 0.1;
for (let mul = 1.01; mul < balance; mul += inc) {
bal = balance, num = 0
while (bal > 0) {
bal -= (wager * Math.pow(mul, num));
num++;
}
if (num < turns) {
if (p >= precision) return last;
p++ , mul = last, inc /= 10;
}
last = mul;
}
}
async function calculate_bankroll() {
let balance = 0
if (!simulation) {
engine.log(`Starting calculating max turns for balance ${engine.balance / 100}`)
balance = engine.balance
} else {
engine.log(`Starting calculating max turns for simulated balance ${simulation_balance / 100}`)
balance = simulation_balance
}
for (let i = 0; i < game_array.length; i++) {
if (ex.debug) {
engine.log(`Calculating bets for ${game_array[ i ].target}x, base bet ${game_array[ i ].basebet / 100}, STW ${game_array[ i ].STW}`)
engine.log(`${game_array[ i ].target}x, mul ${game_array[ i ].multiplier.toFixed(5)}`)
}
let last_bet_size = 0
let turns = 0
let start_bet_size = game_array[ i ].basebet
let bet_size = start_bet_size
let cost = 0
let longest = Math.round(game_array[ i ].target * LONGEST_DIFFCULTY)
let solution_found = false
let multiplier_found = false
while (!solution_found) {
turns++
last_bet_size = bet_size
bet_size *= game_array[ i ].multiplier
cost = cost + bet_size
if (cost > balance) {
turns--
cost = cost - bet_size
bet_size = last_bet_size
solution_found = true
}
}
game_array[ i ].MAX_BET_TURNS = turns
if (!multiplier_found) {
if (ex.debug) { engine.log(`Finding effecient multiplier for ${game_array[ i ].target}x...`) }
game_array[ i ].multiplier = check_multiplier(balance, game_array[ i ].MAX_BET_TURNS, 100, 4)
if (ex.debug) { engine.log(`Found! Multiplier for ${game_array[ i ].target}x is set to ${game_array[ i ].multiplier.toFixed(6)}`) }
multiplier_found = true
last_bet_size = 0
turns = 0
start_bet_size = game_array[ i ].basebet
bet_size = start_bet_size
cost = 0
longest = Math.round(game_array[ i ].target * LONGEST_DIFFCULTY)
solution_found = false
while (!solution_found) {
turns++
last_bet_size = bet_size
bet_size *= game_array[ i ].multiplier
cost = cost + bet_size
if (cost > balance) {
turns--
cost = cost - bet_size
bet_size = last_bet_size
solution_found = true
if (ex.debug) { engine.log(`Final: turn ${turns} cost ${Math.round(cost / 100)}, last bet ${Math.round(last_bet_size / 100)} bits, Reach cap of balance.`) }
} else {
if (ex.debug) { engine.log(`Turn ${turns} cost ${Math.round(cost / 100)}, last bet ${Math.round(bet_size / 100)} bits`) }
}
}
}
let check_stw = false
while (!check_stw) {
if (game_array[ i ].STW + turns <= longest) {
game_array[ i ].STW += 1
} else {
check_stw = true
}
}
if (ex.debug || ex.advanced_log) {
engine.log(`Strategy ${game_array[ i ].target}x calculation is done.`)
}
if (ex.debug) {
engine.log(`${game_array[ i ].target}x STW: ${game_array[ i ].STW}, max cost ${Math.round(cost / 100)} bits , multiplier ${game_array[ i ].multiplier.toFixed(5)}, max bet ${Math.round(bet_size)}, turns ${turns}(+${game_array[ i ].STW})=${turns + game_array[ i ].STW} safe is ${longest}`)
await sleep(10)
}
}
}
(function (I) {
function w(c, a, d) {
var l = 0, b = [], g = 0, f, n, k, e, h, q, y, p, m = !1, t = [], r = [], u, z = !1; d = d || {}; f = d.encoding || "UTF8"; u = d.numRounds || 1; if (u !== parseInt(u, 10) || 1 > u) throw Error("numRounds must a integer >= 1"); if (0 === c.lastIndexOf("SHA-", 0)) if (q = function (b, a) { return A(b, a, c) }, y = function (b, a, l, f) {
var g, e; if ("SHA-224" === c || "SHA-256" === c) g = (a + 65 >>> 9 << 4) + 15, e = 16; else throw Error("Unexpected error in SHA-2 implementation"); for (; b.length <= g;)b.push(0); b[ a >>> 5 ] |= 128 << 24 - a % 32; a = a + l; b[ g ] = a & 4294967295;
b[ g - 1 ] = a / 4294967296 | 0; l = b.length; for (a = 0; a < l; a += e)f = A(b.slice(a, a + e), f, c); if ("SHA-224" === c) b = [ f[ 0 ], f[ 1 ], f[ 2 ], f[ 3 ], f[ 4 ], f[ 5 ], f[ 6 ] ]; else if ("SHA-256" === c) b = f; else throw Error("Unexpected error in SHA-2 implementation"); return b
}, p = function (b) { return b.slice() }, "SHA-224" === c) h = 512, e = 224; else if ("SHA-256" === c) h = 512, e = 256; else throw Error("Chosen SHA variant is not supported"); else throw Error("Chosen SHA variant is not supported"); k = B(a, f); n = x(c); this.setHMACKey = function (b, a, g) {
var e; if (!0 === m) throw Error("HMAC key already set");
if (!0 === z) throw Error("Cannot set HMAC key after calling update"); f = (g || {}).encoding || "UTF8"; a = B(a, f)(b); b = a.binLen; a = a.value; e = h >>> 3; g = e / 4 - 1; if (e < b / 8) { for (a = y(a, b, 0, x(c)); a.length <= g;)a.push(0); a[ g ] &= 4294967040 } else if (e > b / 8) { for (; a.length <= g;)a.push(0); a[ g ] &= 4294967040 } for (b = 0; b <= g; b += 1)t[ b ] = a[ b ] ^ 909522486, r[ b ] = a[ b ] ^ 1549556828; n = q(t, n); l = h; m = !0
}; this.update = function (a) {
var c, f, e, d = 0, p = h >>> 5; c = k(a, b, g); a = c.binLen; f = c.value; c = a >>> 5; for (e = 0; e < c; e += p)d + h <= a && (n = q(f.slice(e, e + p), n), d += h); l += d; b = f.slice(d >>>
5); g = a % h; z = !0
}; this.getHash = function (a, f) {
var d, h, k, q; if (!0 === m) throw Error("Cannot call getHash after setting HMAC key"); k = C(f); switch (a) {
case "HEX": d = function (a) { return D(a, e, k) }; break; case "B64": d = function (a) { return E(a, e, k) }; break; case "BYTES": d = function (a) { return F(a, e) }; break; case "ARRAYBUFFER": try { h = new ArrayBuffer(0) } catch (v) { throw Error("ARRAYBUFFER not supported by this environment"); } d = function (a) { return G(a, e) }; break; default: throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER");
}q = y(b.slice(), g, l, p(n)); for (h = 1; h < u; h += 1)q = y(q, e, 0, x(c)); return d(q)
}; this.getHMAC = function (a, f) {
var d, k, t, u; if (!1 === m) throw Error("Cannot call getHMAC without first setting HMAC key"); t = C(f); switch (a) {
case "HEX": d = function (a) { return D(a, e, t) }; break; case "B64": d = function (a) { return E(a, e, t) }; break; case "BYTES": d = function (a) { return F(a, e) }; break; case "ARRAYBUFFER": try { d = new ArrayBuffer(0) } catch (v) { throw Error("ARRAYBUFFER not supported by this environment"); } d = function (a) { return G(a, e) }; break; default: throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER");
}k = y(b.slice(), g, l, p(n)); u = q(r, x(c)); u = y(k, e, h, u); return d(u)
}
} function m() { } function D(c, a, d) { var l = ""; a /= 8; var b, g; for (b = 0; b < a; b += 1)g = c[ b >>> 2 ] >>> 8 * (3 + b % 4 * -1), l += "0123456789abcdef".charAt(g >>> 4 & 15) + "0123456789abcdef".charAt(g & 15); return d.outputUpper ? l.toUpperCase() : l } function E(c, a, d) {
var l = "", b = a / 8, g, f, n; for (g = 0; g < b; g += 3)for (f = g + 1 < b ? c[ g + 1 >>> 2 ] : 0, n = g + 2 < b ? c[ g + 2 >>> 2 ] : 0, n = (c[ g >>> 2 ] >>> 8 * (3 + g % 4 * -1) & 255) << 16 | (f >>> 8 * (3 + (g + 1) % 4 * -1) & 255) << 8 | n >>> 8 * (3 + (g + 2) % 4 * -1) & 255, f = 0; 4 > f; f += 1)8 * g + 6 * f <= a ? l += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(n >>>
6 * (3 - f) & 63) : l += d.b64Pad; return l
} function F(c, a) { var d = "", l = a / 8, b, g; for (b = 0; b < l; b += 1)g = c[ b >>> 2 ] >>> 8 * (3 + b % 4 * -1) & 255, d += String.fromCharCode(g); return d } function G(c, a) { var d = a / 8, l, b = new ArrayBuffer(d), g; g = new Uint8Array(b); for (l = 0; l < d; l += 1)g[ l ] = c[ l >>> 2 ] >>> 8 * (3 + l % 4 * -1) & 255; return b } function C(c) {
var a = { outputUpper: !1, b64Pad: "=", shakeLen: -1 }; c = c || {}; a.outputUpper = c.outputUpper || !1; !0 === c.hasOwnProperty("b64Pad") && (a.b64Pad = c.b64Pad); if ("boolean" !== typeof a.outputUpper) throw Error("Invalid outputUpper formatting option");
if ("string" !== typeof a.b64Pad) throw Error("Invalid b64Pad formatting option"); return a
} function B(c, a) {
var d; switch (a) { case "UTF8": case "UTF16BE": case "UTF16LE": break; default: throw Error("encoding must be UTF8, UTF16BE, or UTF16LE"); }switch (c) {
case "HEX": d = function (a, b, c) {
var f = a.length, d, k, e, h, q; if (0 !== f % 2) throw Error("String of HEX type must be in byte increments"); b = b || [ 0 ]; c = c || 0; q = c >>> 3; for (d = 0; d < f; d += 2) {
k = parseInt(a.substr(d, 2), 16); if (isNaN(k)) throw Error("String of HEX type contains invalid characters");
h = (d >>> 1) + q; for (e = h >>> 2; b.length <= e;)b.push(0); b[ e ] |= k << 8 * (3 + h % 4 * -1)
} return { value: b, binLen: 4 * f + c }
}; break; case "TEXT": d = function (c, b, d) {
var f, n, k = 0, e, h, q, m, p, r; b = b || [ 0 ]; d = d || 0; q = d >>> 3; if ("UTF8" === a) for (r = 3, e = 0; e < c.length; e += 1)for (f = c.charCodeAt(e), n = [], 128 > f ? n.push(f) : 2048 > f ? (n.push(192 | f >>> 6), n.push(128 | f & 63)) : 55296 > f || 57344 <= f ? n.push(224 | f >>> 12, 128 | f >>> 6 & 63, 128 | f & 63) : (e += 1, f = 65536 + ((f & 1023) << 10 | c.charCodeAt(e) & 1023), n.push(240 | f >>> 18, 128 | f >>> 12 & 63, 128 | f >>> 6 & 63, 128 | f & 63)), h = 0; h < n.length; h += 1) {
p = k +
q; for (m = p >>> 2; b.length <= m;)b.push(0); b[ m ] |= n[ h ] << 8 * (r + p % 4 * -1); k += 1
} else if ("UTF16BE" === a || "UTF16LE" === a) for (r = 2, n = "UTF16LE" === a && !0 || "UTF16LE" !== a && !1, e = 0; e < c.length; e += 1) { f = c.charCodeAt(e); !0 === n && (h = f & 255, f = h << 8 | f >>> 8); p = k + q; for (m = p >>> 2; b.length <= m;)b.push(0); b[ m ] |= f << 8 * (r + p % 4 * -1); k += 2 } return { value: b, binLen: 8 * k + d }
}; break; case "B64": d = function (a, b, c) {
var f = 0, d, k, e, h, q, m, p; if (-1 === a.search(/^[a-zA-Z0-9=+\/]+$/)) throw Error("Invalid character in base-64 string"); k = a.indexOf("="); a = a.replace(/\=/g,
""); if (-1 !== k && k < a.length) throw Error("Invalid '=' found in base-64 string"); b = b || [ 0 ]; c = c || 0; m = c >>> 3; for (k = 0; k < a.length; k += 4) { q = a.substr(k, 4); for (e = h = 0; e < q.length; e += 1)d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(q[ e ]), h |= d << 18 - 6 * e; for (e = 0; e < q.length - 1; e += 1) { p = f + m; for (d = p >>> 2; b.length <= d;)b.push(0); b[ d ] |= (h >>> 16 - 8 * e & 255) << 8 * (3 + p % 4 * -1); f += 1 } } return { value: b, binLen: 8 * f + c }
}; break; case "BYTES": d = function (a, b, c) {
var d, n, k, e, h; b = b || [ 0 ]; c = c || 0; k = c >>> 3; for (n = 0; n < a.length; n +=
1)d = a.charCodeAt(n), h = n + k, e = h >>> 2, b.length <= e && b.push(0), b[ e ] |= d << 8 * (3 + h % 4 * -1); return { value: b, binLen: 8 * a.length + c }
}; break; case "ARRAYBUFFER": try { d = new ArrayBuffer(0) } catch (l) { throw Error("ARRAYBUFFER not supported by this environment"); } d = function (a, b, c) { var d, n, k, e, h; b = b || [ 0 ]; c = c || 0; n = c >>> 3; h = new Uint8Array(a); for (d = 0; d < a.byteLength; d += 1)e = d + n, k = e >>> 2, b.length <= k && b.push(0), b[ k ] |= h[ d ] << 8 * (3 + e % 4 * -1); return { value: b, binLen: 8 * a.byteLength + c } }; break; default: throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER");
}return d
} function r(c, a) { return c >>> a | c << 32 - a } function J(c, a, d) { return c & a ^ ~c & d } function K(c, a, d) { return c & a ^ c & d ^ a & d } function L(c) { return r(c, 2) ^ r(c, 13) ^ r(c, 22) } function M(c) { return r(c, 6) ^ r(c, 11) ^ r(c, 25) } function N(c) { return r(c, 7) ^ r(c, 18) ^ c >>> 3 } function O(c) { return r(c, 17) ^ r(c, 19) ^ c >>> 10 } function P(c, a) { var d = (c & 65535) + (a & 65535); return ((c >>> 16) + (a >>> 16) + (d >>> 16) & 65535) << 16 | d & 65535 } function Q(c, a, d, l) {
var b = (c & 65535) + (a & 65535) + (d & 65535) + (l & 65535); return ((c >>> 16) + (a >>> 16) + (d >>> 16) + (l >>> 16) + (b >>>
16) & 65535) << 16 | b & 65535
} function R(c, a, d, l, b) { var g = (c & 65535) + (a & 65535) + (d & 65535) + (l & 65535) + (b & 65535); return ((c >>> 16) + (a >>> 16) + (d >>> 16) + (l >>> 16) + (b >>> 16) + (g >>> 16) & 65535) << 16 | g & 65535 } function x(c) {
var a = [], d; if (0 === c.lastIndexOf("SHA-", 0)) switch (a = [ 3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428 ], d = [ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ], c) {
case "SHA-224": break; case "SHA-256": a = d; break; case "SHA-384": a = [ new m, new m,
new m, new m, new m, new m, new m, new m ]; break; case "SHA-512": a = [ new m, new m, new m, new m, new m, new m, new m, new m ]; break; default: throw Error("Unknown SHA variant");
} else throw Error("No SHA variants supported"); return a
} function A(c, a, d) {
var l, b, g, f, n, k, e, h, m, r, p, w, t, x, u, z, A, B, C, D, E, F, v = [], G; if ("SHA-224" === d || "SHA-256" === d) r = 64, w = 1, F = Number, t = P, x = Q, u = R, z = N, A = O, B = L, C = M, E = K, D = J, G = H; else throw Error("Unexpected error in SHA-2 implementation"); d = a[ 0 ]; l = a[ 1 ]; b = a[ 2 ]; g = a[ 3 ]; f = a[ 4 ]; n = a[ 5 ]; k = a[ 6 ]; e = a[ 7 ]; for (p =
0; p < r; p += 1)16 > p ? (m = p * w, h = c.length <= m ? 0 : c[ m ], m = c.length <= m + 1 ? 0 : c[ m + 1 ], v[ p ] = new F(h, m)) : v[ p ] = x(A(v[ p - 2 ]), v[ p - 7 ], z(v[ p - 15 ]), v[ p - 16 ]), h = u(e, C(f), D(f, n, k), G[ p ], v[ p ]), m = t(B(d), E(d, l, b)), e = k, k = n, n = f, f = t(g, h), g = b, b = l, l = d, d = t(h, m); a[ 0 ] = t(d, a[ 0 ]); a[ 1 ] = t(l, a[ 1 ]); a[ 2 ] = t(b, a[ 2 ]); a[ 3 ] = t(g, a[ 3 ]); a[ 4 ] = t(f, a[ 4 ]); a[ 5 ] = t(n, a[ 5 ]); a[ 6 ] = t(k, a[ 6 ]); a[ 7 ] = t(e, a[ 7 ]); return a
} var H; H = [ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206,
2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474,
2756734187, 3204031479, 3329325298 ]; "function" === typeof define && define.amd ? define(function () { return w }) : "undefined" !== typeof exports ? ("undefined" !== typeof module && module.exports && (module.exports = w), exports = w) : I.jsSHA = w
})(window);
async function gameResult(nonce) {
let shaObj = new jsSHA("SHA-256", "TEXT");
shaObj.setHMACKey(auditSeed, "HEX");
shaObj.update(`${gameSeed}|${clientSeed}|${nonce}`);
let hash = shaObj.getHMAC("HEX");
hash = hash.substr(0, 52 / 4);
const X = parseInt(hash, 16) / Math.pow(2, 52);
const multiplier = Math.floor(99 / (1 - X));
return Math.max(100, Math.min(multiplier, 100000000));
}
/**
* Alpha usage only for now.
* @param {string} clientSeed
* @param {string} auditSeed
* @param {string} gameSeed
* @param {number} endNonce
* @param {boolean} debug_verifier
* @param {boolean} debug_stats
* @param {number} startNonce
*/
async function check_bustable(clientSeed = ``, auditSeed = ``, gameSeed = ``, endNonce = 1000, debug_verifier = true, debug_stats = true, startNonce = 0) {
if (startNonce == null) { startNonce = 0 }
if (endNonce == null || endNonce == 0) { endNonce = 1000 }
if (clientSeed == null || clientSeed == ``) { clientSeed = '04097893aa9456880f62b29d4c52cf256935868cf50f0eae7ba9c6c02099b589' }
if (auditSeed == null || auditSeed == ``) { auditSeed = 'b27cd3fe415600657a29590fb07e78e12a45075aec492061e3a52ca5c0f6057b' }
if (gameSeed == null || gameSeed == ``) { gameSeed = 'glorious subdued berry' }
let i_played = 0
let won = 0
let loss = 0
let ATL = 0
let ATH = 0
let net = 0
// let will_it_rip = 100000
if (debug_verifier) {
engine.log(`Audit Seed: ${auditSeed}`);
engine.log(`Game Seed: ${gameSeed}`);
engine.log(`Client Seed: ${clientSeed}`);
engine.log();
engine.log(`Beginning process of emulation rolls`);
engine.log(`Nonce | Outcomes`);
}
for (let i = startNonce; i < endNonce; i++) {
let result = await gameResult(i) / 100;
i_played = i
if (debug_verifier) engine.log(`${i} : ${result}`);
if (result >= game_array[ 0 ].target) {
won++
} else {
loss++
}
}
await sleep(5000)
if (debug_stats) {
engine.log(`ATL: n/a`);
engine.log(`ATH: n/a`);
engine.log(`Netprofit: n/a`);
// engine.log(`Balance: ${1000000 / 100}`);
engine.log(`Games played ${i_played} rolls`);
engine.log(`wons = ${won}; loss = ${loss};`)
}
//if (100000 <= 0) {
await sleep(2000)
return true
// } else {
// return false
// }
}
/**
* 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(arr = game_array) {
arr.sort(function (a, b) { return b.bet - a.bet });
}
/**
* Erasing list of existing games
*/
function delete_strategies(arr = game_array) {
engine.log(`List of strategies is clear.`)
arr => { arr = [] }
}
/**
* Turns selected strategy to offline
**/
function kill_strategy(game_type) {
game_type.enabled = false
engine.log(`Strategy ${game_type.target} was set to ${game_type.enabled}`)
}
Array.prototype.quartileMin = function (start, end) {
const arr = this.slice(start, end).sort((a, b) => a - b);
return arr.length % 4 === 0 ? (arr[ arr.length / 4 - 1 ] + arr[ arr.length / 4 ]) / 2 : arr[ (arr.length - 1) / 4 ];
};
Array.prototype.quartileMax = function (start, end) {
const arr = this.slice(start, end).sort((a, b) => a - b);
return arr.length % 4 === 0 ? (arr[ arr.length / 4 * 3 - 1 ] + arr[ arr.length / 4 * 3 ]) / 2 : arr[ (arr.length - 1) / 4 * 3 ];
};
Array.prototype.median = function (arr) {
arr.sort((a, b) => a - b);
var pivot = Math.floor(arr.length / 2);
return arr.length % 2 ? arr[ pivot ] : (arr[ pivot - 1 ] + arr[ pivot ]) / 2;
}
async function preload_setup_script() {
if (ex.reset_static_stats_on_launch) engine.resetStatistics()
setSeed_rules()
await load_pattern()
if (ex.calculate_base) {
await calculate_bankroll()
}
await game_preferences()
engine.clearLog()
engine.log('Data loaded...... OK')
}
async function gather_information() {
if (ex.interval_rolls != 0) { 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(ex.fast_betting.wager, ex.fast_betting.chase) : await engine.bet(ex.fast_betting.wager, ex.fast_betting.chase) : await engine.bet(ex.fast_betting.wager, 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) {
game_array[ i ].LS = 0 // Reset all while playing
}
}
}
}
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 && ex.debug) {
await notification(`Game ended in amount ${current_streak} of 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}`)
if (HIT_MIN_PROFIT_TIMES > 1) {
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() {
let other_output = ``
engine.clearLog()
log_busting_to_console()
if (ex.luck_usage) engine.log(`Luck: ${get_luck()}% | Activation: ${luck_activation}%`)
engine.log(luck_output)
engine.log(`Rolls: ${TOTAL_ROLLS} | Seed: ${nonce}/${change_seed_next} | last run Strategy ${last_strategy}x at streak ${STREAK_ROLL}` + hard_style_logging())
if (ex.advanced_log) {
engine.log(output_message)
other_output = stats_show()
}
engine.log(other_output + ` | ` + `Profit: ${(PROFIT / 100).toFixed(2)} bits`)
if (ex.advanced_log) { features_logging() }
if (ex.debug && ex.hard_style.enabled && PLAY_HARD) engine.log('HARD-PLAY MODE!')
if (simulation) {
engine.log(`Balance ${Math.round(simulation_balance / 100)} bits`)
if (simulation_balance <= 0) {
engine.log(`Game Over`)
engine.stop()
}
}
if (ex.stats_logging.median){
if(ex.stats_logging.median_history){console.log(`History of latest ${ex.stats_logging.median_cargo} games: ${log_history}`)}
console.log(`Median: ${log_history.median(log_history).toFixed(2)}`)
engine.log(`Median: ${log_history.median(log_history).toFixed(2)}`)
if (log_history.length >= ex.stats_logging.median_cargo){log_history = []}
}
}
async function game_preferences() {
if (!fast_loading_config) await sleep(1000)
await engine.clearLog()
await engine.log(`---GAME PREFERENCES---`)
let output = `calculate_base: ${ex.calculate_base}; analyze_streaks: ${ex.analyze_streaks}; debug: ${ex.debug}; advanced_log: ${ex.advanced_log}`
output += `increasing_bets_at_peak: ${ex.increasing_bets_at_peak}; reset_all_after_win: ${ex.reset_to_first_on_hit_win}; increase_STW_by_same_targets: ${ex.increase_STW_by_same_targets},`
output += `disable_target_at_bust: ${ex.disable_target_at_bust}, reset_STW_after_game_pass: ${ex.reset_STW_after_game_pass}`
await engine.log(output)
await engine.log(`----------------------`)
if (!fast_loading_config) await sleep(1500)
}
function get_luck() {
let luck = calculateLuck(TOTAL_BETS, WINS_OVERALL, game_array[ 0 ].target).toFixed(2)
return luck
}
function calculateLuck(gamesPlayed, gamesWon, target) {
let luck = (gamesWon / (gamesPlayed * (1 / target) * (1 - 0.01)) - 1) * 100;
return luck
}
function features_logging() {
let features_satoshi = ``
let features_chains = ``
for (let i = 0; i < game_array.length; i++) {
if (ex.advanced_log) {
if (RISK_BASE != 1.0 || RISK_BASE < 1.0) features_satoshi = `Wager: ${game_array[ i ].bet.toFixed(2)} sats. | Max wager: ${(game_array[ i ].Settings.bet.maximal / 100).toFixed()} bits`
if (game_array[ i ].Settings.modifications.chain_chase.enabled) features_chains = `Chaining: ${game_array[ i ].Settings.modifications.chain_chase.queue}/${game_array[ i ].Settings.modifications.chain_chase.queue_base}`
output_features = `[${i}] ` + ` ${game_array[ i ].target.toFixed(2)}x, ` + features_chains + ` | ` + features_satoshi
if (RISK_BASE != 1.0 || game_array[ i ].Settings.modifications.chain_chase.enabled) {
engine.log(output_features)
}
}
}
}
/**
* Returns data as string with updated information for each target multiplier, profit, base bet.
*/
function stats_show() {
let limitBroadcast = 50
let output = ``
let status = ``
if (game_array.length < limitBroadcast) {
for (let i = 0; i < game_array.length; i++) {
if (game_array[ i ].enabled == true) {
if (ex.debug) {
if (ex.winning_frequency) luck_output = `WinRate: ${Math.round(WinRate(WINS_OVERALL, TOTAL_BETS))} WinProb: ${ProbRun(TOTAL_WINS, game_array[ i ].STREAK_ROLL, 1 / game_array[ i ].target)}, Activation ${luck_activation}, Luck: ${calculateLuck(TOTAL_BETS, WINS_OVERALL, game_array[ i ].target).toFixed(2)}%`;
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(2) / 100}`
if (game_array[ i ].MAX_BET_TURNS > 0 && !game_array[ i ].Settings.bet.return_at.RETURN_BASE) { status = status + `, cycle ${game_array[ i ].CYCLES_PAST}` }
}
if (game_array[ i ].STW != 0) {
if (ex.advanced_log) {
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) / 100} bits | `
}
} else {
status = `Offline. ${game_array[ i ].target.toFixed(2)}x with end bet: ${game_array[ i ].bet / 100} bits`
}
engine.log(status)
}
}
return output
}
function max_win_reach() {
PROFIT = 0
session_value = 0
TOTAL_WINS++
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
session_value = 0
await generateSeed()
if (ex.disable_target_at_bust) 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_decremental()
}
function clampTarget(target) {
let clamp_target
for (let i = 0; i < game_array.length; i++) {
if (game_array[ i ].Settings.modifications.median.enabled) {
clamp_target = Math.max(game_array[ i ].Settings.modifications.median.min_cut, Math.min(game_array[ i ].Settings.modifications.median.max_cut, target));
}
}
return clamp_target
}
function betSize(bet) {
//return Math.round((bet * 100) / 100) * 100
return Math.max(100, Math.round((bet) / 100) * 100)
}
/**
* Returns multiplier with calculated RISK_MULTIPLIER
* @param {Odds to calculate} target
*/
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) {
if (RISK_FACTOR == 0) {
return 0
} else {
return Math.round(get_longest_streak(target) / PLAY_IN_RANGE * RISK_FACTOR)
}
}
function get_max_turns(target) { return get_longest_streak(target) - get_stw(target) }
/**
* Returns perfect multiplier without additional parameters
* @param {Odds to calculate} target
* @param {Round multiplier} toFixed
*/
function get_multiplier(target, fixit = 7) { return (1 / (target - 1) + 1).toFixed(fixit) }
function increase_profit(game_strategy) { return (betSize(game_strategy.bet)) * (game_strategy.target - 1) }
function decrease_profit(game_strategy) { return betSize(game_strategy.bet) }
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}`)
}
}
/** Not used for now */
async function session_place() {
if (ex.session_game.sessionMode && ex.session_game.enabled && session_value > 0) {
session_value = 0
if (!simulation) {
await engine.bet(ex.session_game.sessionBet, ex.session_game.sessionTarget)
} else {
if (simulation_MODE == FULL) {
var { multiplier } = await engine.bet(100, ex.session_game.sessionTarget)
log_history.push(multiplier)
} else {
var { multiplier } = await engine.bet(100, 1.01)
log_history.push(multiplier)
}
if (multiplier < ex.session_game.sessionTarget) {
simulation_balance -= ex.session_game.sessionBet
} else {
simulation_balance += (ex.session_game.sessionBet * ex.session_game.sessionTarget)
}
}
}
}
function session_start(game_strategy) {
let temp = 0
if (ex.session_game.enabled && game_strategy.target >= ex.session_game.sessionTarget && session_value >= 0) {
if (session_value <= 0) {
session_value = 0
temp = session_value
} else {
if (session_value >= ex.session_game.sessionProfit + (ex.session_game.sessionProfit * TOTAL_WINS)) {
temp = ex.session_game.sessionBet + (ex.session_game.sessionBet * TOTAL_WINS)
}
}
}
return temp
}
function reset_to_first_strategy() {
if (ex.reset_to_first_on_hit_win) {
RUNNING = true
}
return RUNNING
}
/* Attributes - Target */
async function target_attributes(game_strategy, multiplier) {
if (game_strategy.Settings.target.multiplier != 1.0) {
if (game_strategy.target < game_strategy.Settings.target.minimal || game_strategy.target > game_strategy.Settings.target.maximal) {
// if (game_strategy.Settings.target.return_at.return) {
game_strategy.target = game_strategy.Settings.target.base
// } else {
// game_strategy.target = game_strategy.Settings.target.maximal
// }
}
if (game_strategy.target <= multiplier) { //Win behavior
if (game_strategy.Settings.target.return_at.on_win) {
game_strategy.target = game_strategy.Settings.target.base
} else {
if (game_strategy.Settings.target.mode == `mul`) {
game_strategy.target *= game_strategy.Settings.target.multiplier
}
if (game_strategy.Settings.target.mode == `add`) {
game_strategy.target += game_strategy.Settings.target.multiplier
}
}
} else { // Lose behavior
if (game_strategy.Settings.target.return_at.on_lose) {
game_strategy.target = game_strategy.Settings.target.base
} else {
if (game_strategy.Settings.target.mode == `mul`) {
game_strategy.target *= game_strategy.Settings.target.multiplier
}
if (game_strategy.Settings.target.mode == `add`) {
game_strategy.target += game_strategy.Settings.target.multiplier
}
}
}
// DOUBLE CHECK
if (game_strategy.target < game_strategy.Settings.target.minimal || game_strategy.target > game_strategy.Settings.target.maximal) {
if (game_strategy.Settings.target.return_at.return) {
game_strategy.target = game_strategy.Settings.target.base
} else {
//game_strategy.target = game_strategy.Settings.target.maximal
}
}
if (game_strategy.target >= 10) {
//game_strategy.target = game_strategy.target.toFixed(game_strategy.Settings.target.digits_round)
} else if (game_strategy.target >= 50) {
//game_strategy.target = game_strategy.target.toFixed(game_strategy.Settings.target.digits_round + 1)
}
} else {
return
}
}
/* Attributes - Betting */
async function betting_attribute(game_strategy, multiplier) {
if (game_strategy.bet > game_strategy.Settings.bet.maximal || game_strategy.bet < game_strategy.Settings.bet.minimal) {
game_strategy.bet = game_strategy.basebet_default
}
if (game_strategy.Settings.bet.multiplier != 1.0) {
if (game_strategy.target <= multiplier) { //Win behavior
if (game_strategy.Settings.bet.return_at.on_win) {
game_strategy.bet = game_strategy.basebet_default
} else {
if (game_strategy.Settings.bet.mode == `mul`) {
game_strategy.bet *= game_strategy.Settings.bet.multiplier
} else if (game_strategy.Settings.bet.mode == `add`) {
game_strategy.bet += game_strategy.Settings.bet.multiplier
}
}
} else if (multiplier < game_strategy.target) { // Lose behavior
if (game_strategy.Settings.bet.return_at.on_lose) {
game_strategy.bet = game_strategy.basebet_default
} else {
if (game_strategy.Settings.bet.mode == `mul`) {
game_strategy.bet *= game_strategy.Settings.bet.multiplier
} else if (game_strategy.Settings.bet.mode == `add`) {
game_strategy.bet += game_strategy.Settings.bet.multiplier
}
}
}
} else {
game_strategy.bet *= game_strategy.multiplier
}
}
async function passive_phase() {
let NOT_TIME = true
let out_standing = 0
while (NOT_TIME) {
engine.clearLog()
engine.log(`---PASSIVE PERIOD---`)
engine.log(`${get_luck()}%/${luck_activation}`)
engine.log(`--------------------`)
TOTAL_BETS++
const { multiplier } = await engine.bet(betSize(game_array[ 0 ].basebet), game_array[ 0 ].target + 5)
log_history.push(multiplier)
if (multiplier > game_array[ 0 ].target) { //WIN
WINS_OVERALL++
} else { //LOSE
out_standing++
}
if (get_luck() > luck_activation || out_standing >= PASSIVE_PERIOD_NOT_LONGER) {
cool_down = PASSIVE_PERIOD_NOT_LONGER
NOT_TIME = false
}
}
}
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
if (ex.stop_on_streak_catch) {
gong()
engine.log(`Stopped due option stop_on_streak_catch = true, catched target ${last_strategy}x.`)
engine.stop()
}
while (RETRY) {
if (game_strategy.STREAK_ROLL >= game_strategy.MAX_BET_TURNS && game_strategy.MAX_BET_TURNS != 0) {
if (game_strategy.Settings.bet.return_at.RETURN_BASE) {
game_strategy.bet = game_strategy.basebet
}
RETRY = false
return
}
if (!simulation) {
if (ex.interval_rolls != 0) { await sleep_decreasing_interval() }
var { multiplier } = await engine.bet(betSize(game_strategy.bet + session_start(game_strategy)), game_strategy.target)
log_history.push(multiplier)
} else {
if (simulation_MODE == FULL) {
var { multiplier } = await engine.bet(100, game_strategy.target)
log_history.push(multiplier)
} else {
var { multiplier } = await engine.bet(100, 1.01)
log_history.push(multiplier)
}
if (multiplier < game_strategy.target) {
simulation_balance -= (game_strategy.bet + session_start(game_strategy))
} else {
simulation_balance += ((game_strategy.bet + session_start(game_strategy)) * game_strategy.target)
}
}
//gong()
await sound_engine(multiplier, false, game_strategy.target)
TOTAL_BETS++
TOTAL_ROLLS++
nonce++
if (multiplier < game_strategy.target) { // Lose
game_strategy.STREAK_ROLL++
PROFIT -= decrease_profit(game_strategy)
session_value -= decrease_profit(game_strategy)
game_strategy.PROFIT -= decrease_profit(game_strategy)
if (PROFIT - game_strategy.bet < ex.hard_style.max_loss && PLAY_HARD ||
(Math.min(1, (multiplier / game_strategy.target)) >= game_strategy.proximity)) {
hit_hard(false)
RETRY = false
}
if (game_strategy.CYCLES_PAST >= 2 && ex.increasing_bets_at_peak) {
if (cycles_activation >= 2) {
game_strategy.basebet = game_strategy.basebet * ex.increasing_bets_at_peak_value
game_strategy.bet = game_strategy.basebet
await updateLog()
cycles_activation = 0
}
}
if (!game_strategy.Settings.bet.return_at.RETURN_BASE) {
allow_seed_reset = false // if return base is set to false, then we do not allow change seed until this strategy will end its period
}
} else { // Win
PROFIT += increase_profit(game_strategy)
session_value += increase_profit(game_strategy)
if (ex.increase_basebet_on_wins > 0 && ex.increase_basebet_times > 0 && ex.increase_basebet_after_streak <= 0){
game_strategy.basebet = game_strategy.basebet + ex.increase_basebet_on_wins
game_strategy.basebet_default = game_strategy.basebet
ex.increase_basebet_times--
}
game_strategy.PROFIT += increase_profit(game_strategy)
if (game_strategy.Settings.modifications.chain_chase.enabled) {
if (game_strategy.Settings.modifications.chain_chase.queue > 0) {
game_strategy.Settings.modifications.chain_chase.queue--
RETRY = true
} else {
game_strategy.bet = game_strategy.basebet
game_strategy.Settings.modifications.chain_chase.queue = game_strategy.Settings.modifications.chain_chase.queue_base
RETRY = false
}
await updateLog()
gong()
} else {
RETRY = false
if (game_strategy.Settings.bet.multiplier == 1.0) {
game_strategy.bet = game_strategy.basebet
}
}
if (ex.increasing_bets_at_peak) {
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
}
await updateLog()
}
}
game_strategy.CYCLES_PAST = 0
WINS_OVERALL++
if (!game_strategy.Settings.bet.return_at.RETURN_BASE) {
allow_seed_reset = true // if return base is set to false, then we allow change seed as period is ended
}
if (game_array[ 0 ].target == game_array[ game_array.length - 1 ].target && ex.increase_STW_by_same_targets) {
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) hit_hard(false)
if (ex.reset_STW_after_game_pass) await updateStreaks(multiplier)
reset_to_first_strategy()
}
await updateLog()
// Attribute sectors
//
await betting_attribute(game_strategy, multiplier)
await target_attributes(game_strategy, multiplier)
/* Attributes - Luck */
if (ex.winning_frequency) { // Luck Set
luck_activation = calculateLuck(TOTAL_BETS, WINS_OVERALL, game_strategy.target).toFixed(2)
game_strategy.base /= 2
}
if (get_luck() < luck_activation && cool_down <= 0 && ex.luck_usage) {
//game_strategy.bet = game_strategy.basebet * RISK_BASE
game_strategy.Settings.bet.maximal = BET_PERCENT_FROM_BK
await passive_phase()
}
//
// Features - Probability
//
//let chance = ProbRun(rolls, game_strategy.STREAK_ROLL, 1 / game_strategy.target)
//gen.log(`Probability: ${(chance*100).toFixed(2)}%`)
// Features - Special
if (!ex.reset_STW_after_game_pass) await updateStreaks(multiplier)
Summary(game_strategy.STREAK_ROLL)
await updateLog()
// Features - Conditions
//
// End Attributes sections
if (PROFIT > maxProfit + (maxProfit * TOTAL_WINS) || PROFIT - game_strategy.bet < minProfit) {
RETRY = false
condition_to_bust(game_strategy)
}
if (FORCE_STOP_IF_LOWER != 0 && engine.balance / 100 <= FORCE_STOP_IF_LOWER) engine.stop()
if (game_strategy.STREAK_ROLL > game_strategy.MAX_STREAK) {
game_strategy.MAX_STREAK = game_strategy.STREAK_ROLL
}
}
if (game_strategy.STREAK_ROLL >= ex.increase_basebet_after_streak && ex.increase_basebet_times > 0){
game_strategy.basebet += ex.increase_basebet_on_wins
game_strategy.basebet_default = game_strategy.basebet
ex.increase_basebet_times--
}
}
/**
* Syntax to use new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base)
* @type {number} BaseBet Base bet which from strategy starting to play, amount is set in bits.
* @type {number} Target Base target which from strategy starting to play.
* @type {number} MaXBettuns Max bet turns allowed nscript to do.
* @type {number} StreakToWait Strea k to wwait before strategy will start bet to you.
* @type {float} Multiplier Multiply bets on amount you specify, if you leave it blank, itw il automatically.
* @type {boolean} Return_Base Set strategy to reset bet or no, to basebe, if max bet turns was reached.
*/
function Strategy(target = 2, basebet = 1, max_bet_turns = 0, STW = get_stw(target), multiplier = get_formula_multiplier(target), return_base = false) {
/* Object Main Properties || target, base bet, bet, max bet turns, stw, multiplier || enabled */
this.target = target;
this.basebet = basebet * 100 * RISK_BASE
this.basebet_default = basebet * 100 * RISK_BASE
this.bet = basebet * 100 * RISK_BASE
this.MAX_BET_TURNS = max_bet_turns;
this.STW = STW;
this.multiplier = multiplier;
this.enabled = true;
/* Object Triggers || ACTION, PRE_ROLL */
this.ACTION = async function () { await strategy_play(this) };
this.PRE_ROLL = async function () { } // {engine.log(`Luck: ${calculateLuck(this.STREAK_ROLL,this.RUNS,this.target-0.02)}%`);}//{for (let i = 0; i < target; i++){engine.skip()} }; //engine.log(`${probRunMulti(2000, 3, 0.105, 3)}`)
/* Object Properties - in future loading/save implementation */
this.CYCLES_PAST = 0;
this.proximity = 1.0
this.LS = 0;
this.PROFIT = 0;
this.RUNS = 0;
this.MISSED = 0;
this.STREAK_ROLL = 0;
this.MAX_STREAK = 0;
this.WINS = 0;
/* Object Bet Attributes || bet: multiplier, base, mode(mul/add), minimal, maximal, return_at(RETURN_BASE, on_win, on_lose) */
this.Settings = {
bet: {
multiplier: 1.0,
base: basebet * RISK_BASE,
mode: `mul`, /* mul - multiply, add - static additional */
minimal: basebet * RISK_BASE,
_maximal: engine.balance / 100 * BET_PERCENT_FROM_BK,
get maximal() { return this._maximal },
set maximal(val) {
this._maximal = engine.balance / 100 * val
engine.log(`Strategy ${target}x; Maximal bet size is set to ${Math.round(this._maximal) / 100} bits`)
},
return_at: {
RETURN_BASE: return_base,
on_win: true,
on_lose: false,
},
},
/* Object Target Attributes || target: multiplier, base, mode(mul/add), minimal, maximal, return_at(return, on_win, on_lose) */
target: {
multiplier: 1.0,
base: target * ex.mul_target,
mode: `mul`, /* mul - multiply, add - static additional */
minimal: target * ex.mul_target,
maximal: 1000000,
digits_round: 2,
return_at: {
return: true,
on_win: true,
on_lose: false,
},
},
/* Object Modifications || modifications: chain_chase[enabled/queue], median[enabled, bet_balance, skips, min, max cut], pullee[enabled, power] */
modifications: {
chain_chase: {
enabled: false,
_queue_base: 3,
queue: 3,
get queue_base() { return this._queue_base },
set queue_base(val) { this._queue_base = this.queue = val },
},
median: {
enabled: false,
bet_balance: 0.1,
skips_used_by_median: 10,
min_cut: 1.5,
max_cut: 2,
},
pullee: {
enabled: false,
power: 0.5,
}
},
}
}
/* 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()
}
}
/* Words for setting seed. Not used anymore. */
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()) ]
}
function setSeed_rules() {
if (RISK_FACTOR == 0) {
change_seed_next = change_seed
} else {
change_seed_next = change_seed_next_STW
}
}
async function generateSeed() {
if (ex.luck_usage) {
luck_activation = get_luck()
}
try {
const { server_seed_hash } = await engine.newSeedPair()
if (ex.debug) {
engine.log(`Server hash: ${server_seed_hash}`)
}
}
catch (e) {
engine.log(`Seed is already was reset`)
}
try {
const clientSeed = await createSeed()
await engine.setClientSeed(clientSeed)
nonce = 0
if (ex.debug) {
engine.log(`Seed was set to: ${clientSeed}`)
}
}
catch (e) {
if (ex.debug) {
engine.log(`Client seed already is used`)
}
}
}
async function createSeed() {
const s = new TextEncoder('utf-8').encode(Date.now());
const h = await crypto.subtle.digest('SHA-256', s);
const a = Array.from(new Uint8Array(h));
const r = a.map(b => ('00' + b.toString(16)).slice(-2)).join('');
return r;
}
var diffculty_sleep = ex.interval_rolls
/* Sleep with changing interval overtime */
async function sleep_decreasing_interval() {
if (diffculty_sleep != 0) {
diffculty_sleep -= 1
} else {
diffculty_sleep = ex.interval_rolls
}
await sleep(diffculty_sleep)
}
/* Sleep with set static interval of milliseconds */
async function sleep(ms = ex.interval_rolls) {
if (ms != 0) return new Promise(resolve => setTimeout(resolve, ms))
}
/* Strategy playing of pullee */
async function strategy_pullee(bet_pull, target_pull) {
//let target = target_pull
//let bet = bet_pull
let rolls = 0
while (true) {
if (rolls >= change_seed && change_seed != 0) {
await generateSeed()
rolls = 0
} else { rolls++ }
engine.clearLog()
engine.log(`Roll: ${rolls}`)
engine.log(`Bet: ${Math.round(bet.pull())}`)
engine.log(`Target: ${target.pull().toFixed(2)}`)
engine.log(`Profit `)
const { multiplier } = await this.bet(betSize(bet_pull.current), target_pull.current.toFixed(2) + 1)
if (multiplier >= target.current.toFixed(2) + 1) {
sound_loop(5)
target.pull("min")
bet.pull("min")
}
}
}
/* Power functions modification - Can create using a single number as an argument, and modify later if needed */
function CreatePullee(initial, min = undefined, max = undefined, power = 0) {
min === undefined ? min = initial : null;
max === undefined ? max = initial : null;
var pullee = {
min: min,
max: max,
current: initial,
puller: "max",
reversed: false,
initial: initial,
power: power
}
return function () {
// yank() will instantly pull the number to the puller (essentially a 100% power pull)
pullee.yank = function (puller = pullee.puller) { pullee.current = pullee[ puller ]; return pullee.current; };
// attach the pull function so it can be called as a method
pullee.pull = function (puller = undefined) { pullee.current = pull(pullee, puller); return pullee.current; };
// attach a function to reverse the polarity, reversed will become true if false, and false if true
pullee.reverse = function () { pullee.reversed = !pullee.reversed; }
return pullee;
};
}
function pull(num = undefined, to_num = undefined, percent = undefined) {
var pullee;
if (typeof num === "object") {
pullee = {};
pullee = Object.create(num);
num = pullee.current;
if (to_num !== undefined) {
if ((typeof to_num === "string") && (to_num === "max" || to_num === "min" || to_num === "reverse")) {
if (to_num === "reverse") {
let reversable = false;
pullee.puller === "max" ? reversable = "min" : null;
pullee.puller === "min" ? reversable = "max" : null;
if (reversable !== false) {
pullee.puller = reversable;
}
} else {
pullee.puller = to_num;
}
to_num = pullee[ pullee.puller ];
} else if (typeof to_num === "number") {
} else if (typeof to_num === "string") {
if (pullee[ to_num ] !== undefined) {
pullee.puller = to_num;
to_num = pullee[ pullee.puller ];
} else {
to_num = pullee[ pullee.puller ];
}
} else {
to_num = pullee[ pullee.puller ];
}
} else {
if (pullee.reversed === true && (pullee.puller === "max" || pullee.puller === "min")) {
let reversable = false;
pullee.puller === "max" ? reversable = "min" : null;
pullee.puller === "min" ? reversable = "max" : null;
if (reversable !== false) {
pullee.puller = reversable;
}
}
to_num = pullee[ pullee.puller ];
}
if (percent !== undefined) {
pullee.power = percent;
} else {
percent = pullee.power;
}
} else {
}
let pull_strength;
if (num === undefined || to_num === undefined || percent === undefined) {
console.log('PULL() Error, an argument was missing.');
pull_strength = 0;
} else if (typeof num !== "number" || typeof to_num !== "number" || typeof percent !== "number") {
console.log('PULL() Error, all arguments must be numbers');
pull_strength = 0;
} else {
percent > 1 ? percent = 1 : null;
pull_strength = ((to_num - num) * percent);
}
return (num + pull_strength);
}
async function gong() {
const audio = new Audio("https://bustadice.com/5bb187b7ef764e76fb519939f77288c1.mp3")
if (ex.game_sounds) await audio.play()
return new Promise(resolve => audio.onended = resolve)
}
/* Playing sound loop by number or by name from sound track listed below. */
async function sound_loop(sound_number, name) {
let sound_track = [ `cl_hihat`, `claves`, `conga1`, `cowbell`, `hi_conga`, `hightom`, `rimshot`, `snare`, `tom1`, `sc` ] // Sounds are hosted on gist users content repository
let url = `https://raw.githubusercontent.com/ruzli/misc/master/`
let format = `.wav`
let full_string = url + name + format
if (name != undefined) {
full_string = url + name + format
} else if (sound_number != undefined) {
full_string = url + sound_track[ sound_number ] + format
} else {
engine.log(`Sound url not found.`)
}
const audio = new Audio(full_string)
if (ex.game_sounds) await audio.play()
return new Promise(resolve => audio.onended = resolve)
}
async function sound_engine(multiplier, beat_mode = false, beat_target = undefined) {
if (multiplier == undefined) {
engine.log(`Something is wrong with sound engine.`)
await sleep(3000)
return
}
if (beat_mode) {
if (multiplier < 5) {
sound_loop(8)
} else if (multiplier < 10) {
sound_loop(1)
} else if (multiplier < 15) {
sound_loop(2)
} else if (multiplier < 20) {
sound_loop(5)
} else if (multiplier < 25) {
sound_loop(4)
} else if (multiplier < 30) {
sound_loop(6)
} else if (multiplier < 35) {
sound_loop(7)
} else if (multiplier < 40) {
sound_loop(0)
} else {
sound_loop(3)
}
} else {
if (multiplier >= beat_target || beat_target != undefined) {
sound_loop(8)
} else {
sound_loop(3)
}
}
}
async function normal_betting() {
const { multiplier } = await analyzeBet()
log_history.push(multiplier)
TOTAL_ROLLS++
nonce++
history.unshift(multiplier);
// save the result and update the patterns
for (let i = 0; i < patterns.length; i++) {
await patterns[ i ].update(history);
}
if (skipStep == 0) {
if (multiplier > 1.00) {
if (simulation) simulation_balance += 0.01
PROFIT += 0.01
} else {
if (simulation) simulation_balance -= 1
PROFIT -= 1
}
}
await updateStreaks(multiplier)
await updateLog()
return
}
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_ROLLS++
if (result.value) {
if (result.multiplier > 1.00) {
if (simulation) simulation_balance += 0.01
PROFIT += 0.01
} else {
if (simulation) simulation_balance -= 1
PROFIT -= 1
}
}
nonce++
log_history.push(result.multiplier)
await updateStreaks(result.multiplier);
await updateLog();
});
queue = [];
}
/**
* That one calculates the chance of hitting win of r length in n rolls with a % roll success probability of p
* @param {number} numbers
* @param {number} rolls
* @param {number} probability
* @param {number} streaks
*/
function ProbRunMulti(numbers, rolls, probability, streaks) {
let out = [ streaks ]
let prob = [ numbers ]
for (let i = 0; i < numbers; i++) {
prob[ i ] = [ rolls ];
}
let c = Math.pow((1 - probability) * probability, rolls);
let curr, prev, first, i, j;
if (rolls <= numbers) prob[ 1, rolls ] = Math.pow(probability, rolls);
for (i = (rolls + 1); i <= numbers; i++) {
prob[ 1, i ] = prob[ 1, i - 1 ] + (1 - prob[ 1, i - rolls - 1 ]) * c;
}
out[ 0 ] = prob[ 1, numbers ];
for (j = 1; j < streaks; j++) {
curr = j % 2
prev = (j + 1) % 2
first = j * (rolls + 1) - 1;
if (first <= numbers) prob[ curr, first ] = Math.pow(probability, (j * rolls)) * Math.pow((1 - probability), (j - 1));
for (i = (first + 1); i <= numbers; i++) {
prob[ curr, i ] = prob[ j, i - 1 ] + (prob[ prev, (i - rolls - 1) ] - prob[ curr, (i - rolls - 1) ]) * c;
}
out[ j ] = prob[ curr, numbers ];
}
return Math.round(out).toFixed(7);
};
function WinRate(wins, games) {
return Math.round((wins / games) * 100).toFixed(2)
}
/**
* That one calculates the chance of hitting win of r length in n rolls with a % roll success probability of p
* @param {number of rolls} n
* @param {length of concurrent rolls} r
* @param {probability of rolls} p
*/
function ProbRun(rolls, lossCount, probability) {
let prob = [ lossCount ],
c, iter, last, i, j;
iter = rolls / (lossCount + 1)
last = Math.round(rolls - iter * (lossCount + 1));
c = (1 - probability) * Math.pow(probability, lossCount);
prob[ lossCount ] = Math.pow(probability, lossCount);
for (j = 1; j < iter; j++) {
prob[ 0 ] = prob[ lossCount ] + (1 - prob[ 0 ]) * c;
for (i = 1; i < lossCount; i++) {
prob[ i ] = prob[ i - 1 ] + (1 - prob[ i ]) * c
}
}
return Math.round(prob[ last ]).toFixed(2);
}
var skips_used_by_median = 3, results = [], loses = [], vectorApex, nextBet, DEBUG = true, BET_BALANCE = 0.1;
function calcTarget(skips_used_by_median, results) {
let pLen = results.length
if (pLen < skips_used_by_median) {
if (DEBUG) { engine.log("[DEBUG] Not enough input to slice. Returning.. ") }
//return
}
let r = results.slice(pLen - (skips_used_by_median), pLen).sort((a, b) => a - b),
len = r.length,
mid = Math.floor(len / 2)
if (DEBUG) { engine.log(`Target is ${clampTarget((len % 2 ? r[ mid ] : ((r[ mid - 1 ] + r[ mid ]) / 2)))}`) }
return clampTarget((len % 2 ? r[ mid ] : ((r[ mid - 1 ] + r[ mid ]) / 2))) / 100
}
function calcBet() {
engine.log(`Starting calculate median bet size`)
let lossCount = loses.length || 0
let baseBet = betSize(engine.balance * (BET_BALANCE / (200 - lossCount)));
engine.log(`base Bet is ${baseBet / 100}`)
let vectorApex = calcTarget(skips_used_by_median, results);
if (!lossCount) {
if (DEBUG) { engine.log(`[DEBUG] Base bet ${baseBet / 100}, no losses.`); }
return baseBet;
}
let losses = (loses.reduce((a, b) => a + b) * 100);
let nextBet = betSize((baseBet + (losses / ((vectorApex * 100) - 1))));
if (DEBUG) engine.log(`[DEBUG] Next ${betSize(nextBet)}, (base ${betSize(baseBet)}+(${losses / 100}/${vectorApex} losses)`);
return nextBet;
}
/* Strategy playing of median */
async function median_loop(game_strategy) {
while (true) {
await sleep_decreasing_interval()
//if (results.length < hmrsv) return;
nextBet = calcBet(), vectorApex = calcTarget(game_strategy.Settings.modifications.median.skips_used_by_median, results)
if (results.length < game_strategy.Settings.modifications.median.skips_used_by_median) {
if (DEBUG) engine.log(`[DEBUG] gathered initial data (${results.length}/${game_strategy.Settings.modifications.median.skips_used_by_median} results)`);
var { multiplier } = await engine.skip();
} else {
engine.log(`[INFO] Balance: ${engine.balance / 100} bits. Betting ${nextBet / 100} bits @ ${vectorApex * 100}x next.`)
var { multiplier } = await engine.bet(betSize(nextBet), vectorApex * 100);
log_history.push(multiplier)
sound_engine(multiplier)
}
results.push(multiplier);
if (multiplier >= vectorApex * 100) {
loses = []
let profit = nextBet * vectorApex - nextBet;
engine.log(`[WIN] Won at ${multiplier}x, Cashed at ${vectorApex * 100}x for ${profit / 100} bits profit.`);
} else {
loses.push(nextBet / 100)
let loss = loses.reduce((a, b) => a + b);
engine.log(`[LOSS] Bust at ${multiplier}x, Current losses at ${loss} bits`);
}
engine.log(`Loses: ${loses.length}`)
}
}
/* Huge Addon which gives alot of advantages in rolls manipulation */
class Pattern {
/**
* constructor - Description
*
* @param {array} sequence Defines the pattern sequence as 0 for <1.98x and 1 for >1.98x (or equal to 1.98x)
* @param {number} [cooldown=0] Time required before pattern can be triggered again.
* @param {type} action Function which is called when pattern is found.
* @param {array} actionData Additional parameters passed in action calls.
*/
constructor (sequence, cooldown = 0, action, ...actionData) {
this.enabled = true;
this.active = true;
this.lastSeen = Date.now();
this.sequence = sequence.reverse();
this.length = sequence.length;
this.elapsed = 0;
this.cooldown = cooldown;
this.action = action;
this.actionData = actionData;
}
/**
* update - Description
*
* @param {Array} results Array of game results
*/
async update(results) {
if (!this.enabled) {
return;
} else if (!this.active) {
if (this.cooldown) {
if (typeof this.cooldown === "number" && this.elapsed > this.cooldown) {
// cooldown is over, pattern enabled.
console.log(`Cooldown is up for ${this.sequence}`);
this.active = true;
} else {
console.log(`Still on cooldown for ${this.sequence}`);
}
}
} else {
let segment = results.slice(0, this.length);
console.log(segment);
let progress = 0;
for (let i = 0; i < this.length; i++) {
if ((this.sequence[ i ] < 0 && segment[ i ] <= Math.abs(this.sequence[ i ])) ||
(this.sequence[ i ] > 0 && segment[ i ] >= this.sequence[ i ]) || this.sequence[ i ] === 0) {
// check if game result matches sequence
progress++;
} else { return; }
}
// found entire sequence
if (progress >= this.length) {
if (this.cooldown > 0) { this.active = false; }
// update counters
this.lastSeen = Date.now();
this.elapsed = 0;
console.log(`Found pattern ${this.sequence}!`);
if (this.action && typeof this.action == "function") {
// call action func
await this.action.apply(this, this.actionData);
}
}
}
this.elapsed++;
}
}
var RUNNING = false
/* Main loop is starting from here */
const main = async () => {
await preload_setup_script()
while (true) {
if (ex.analyze_streaks) {
await gather_information()
}
for (let igo = 0; igo < game_array.length; igo++) {
if (ex.reset_to_first_on_hit_win && RUNNING == true) {
igo = 0
RUNNING = false
}
if (game_array[ igo ].enabled) {
await game_array[ igo ].ACTION()
await game_array[ igo ].PRE_ROLL()
if (nonce >= change_seed_next && allow_seed_reset) {
await generateSeed()
}
}
}
}
}
async function credits() {
engine.log(`Sandbox Script made by by Ruzli. v${ver}.`)
await sleep(1000)
}
await credits()
/* 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 if (error.message === "insufficient balance") {
await this.log("Not enough balance to bet");
await this.stop();
} else {
throw error;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment