Skip to content

Instantly share code, notes, and snippets.

@ruzli
Last active March 1, 2023 10:08
Show Gist options
  • Save ruzli/5cea3323f077b0eaffa9ea75bb26759c to your computer and use it in GitHub Desktop.
Save ruzli/5cea3323f077b0eaffa9ea75bb26759c to your computer and use it in GitHub Desktop.
Sandbox_script ver2.15 by Ruzli #0001, If you liked my sandbox and want say big thanks, or want support my team, you can make donation to our team here - [1GAMw83k1KcrZrj2eorEEDdSnCoWEGpnz3]
var config = {
//******************COMMON****************** */
PASTE_CASE: { label: "Paste", type: "text", value: "Paste raw text [see F12]" },
cb_globals: {
label: "Sandbox", type: "radio", value: "SETUP", 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: 20 },
merged: { label: "Run both in sandbox and configuration launch", type: "noop", value: "" },
}
},
//******************GLOBAL****************** */
riskHeader: { label: "Global Risk's Settings", type: "noop", value: "" },
RISK_FACTOR: { label: "Risk Factor (skipping amount - 1.0 = 100%, no skipping - 0.0 = 0%)", type: "multiplier", value: 1.3 },
RISK_MULTIPLIER: { label: "Risk Multiplier (multiplier amount - Add)", type: "multiplier", value: 0.001 },
RISK_BASE: { label: "Risk Base (overall base bet regulation)", type: "multiplier", value: 2.0 },
dynamic_risk_factor: { label: "Dynamic risk factor, based on median", type: "checkbox", value: false },
globalHeader: { label: "Global Settings (-1 = disable, 0 = auto)", type: "noop", value: "" },
sb_stw: { label: "STW - Streak To Wait", type: "number", value: 25 },
sb_increase_bb_on_streak: { label: "Increase basebet after streak happen(rolls)", type: "number", value: -1 },
//******************BETS****************** */
bettingHeader: { label: "Bets", type: "noop", value: "" },
sb_base_bet: { label: "Base Bet", type: "balance", value: 300 },
sb_cb_base_bet_percent: { label: "Base Bet in percent", type: "checkbox", value: false },
sb_base_bet_percent: { label: "Bet in percent(from balance)", type: "number", value: 1 },
sb_max_bet_turns: { label: "Max Bet turns (set to -1 to play infinity amount of rolls until hit)", type: "number", value: 27 },
sb_increase_bb_on_wins: { label: "Increase basebet after hit win(satoshi)", type: "number", value: 20 },
sb_increase_bb_times: { label: "Increase basebet after hit win amount times", type: "number", value: 0 },
sb_max_bk_percent: { label: "Max percent bet of balance usage", type: "number", value: 100 },
cb_bets_modes: {
label: "Bet Change [sub, mul, add][1 = flat, 0 = auto]", type: "radio", value: "mul", options: {
mul: { label: "Bet Multiplier", type: "multiplier", value: 1.08 },
add: { label: "Static Change", type: "balance", value: 100 },
}
},
//***************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 },
//******************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
}
},
cb_target_modes: {
label: "Target Change [sub, mul, add]", type: "radio", value: "mul", options: {
mul: { label: "Target Multiplier", type: "multiplier", value: 1.0 },
add: { label: "Static Change", type: "number", value: 0.30 }
}
},
//**************TARGET CONDITIONS*************** */
targets_conditionHeader: { label: "Targets Conditions", type: "noop", value: "" },
sb_target_minimal: { label: "Minimal Target", type: "number", value: 2 },
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 },
//******************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 },
/****************** GAMEPLAY MODIFICATIONS - Fast Betting ******************/
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 },
/****************** GAMEPLAY MODIFICATIONS - Median ******************/
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 },
/****************** GAMEPLAY MODIFICATIONS - Pullee ******************/
att_mod_pullee_Header: { label: "Gameplay Feature - Pullee(Bet/Target: Maximal, Minimal, Multiplier)", 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: "Stop if", type: "noop", value: "" },
maxProfit: { label: "Profit is above", type: "balance", value: 3000000 },
minProfit: { label: "Profit is below", type: "balance", value: -3000000 },
conditionHeader: { label: "Condition Regulations", type: "noop", value: "" },
sb_stop_on_catch: { label: "Stop script on streak catch", type: "checkbox", value: false },
sb_disable_target_at_bust: { label: "Kill busted targets, life set in amount allow to lose", type: "checkbox", value: false },
sb_FORCE_STOP_IF_LOWER: { label: "Force stop if balance lower than specified amount(0 to disable feature)", type: "number", value: 0 },
sb_HIT_MIN_PROFIT_TIMES: { label: "HIT MIN PROFIT TIMES", type: "number", value: 1 },
sb_HIT_MAX_PROFIT_TIMES: { label: "HIT MAX PROFIT TIMES", type: "number", value: 1 },
//******************OTHER*********************** */
otherHeader: { label: "Other Settings", type: "noop", value: "" },
sb_debug: { label: "Minimize output in logging", type: "checkbox", value: true },
sb_debug_common: { label: "Show debug logging", type: "checkbox", value: false },
sb_test_rolling: { label: "Test mode [rolling speed ms]", type: "number", value: 500 },
sb_simulation_balance: { label: "Simulation Balance", type: "balance", value: 10000000 },
sb_simulation_mode: { label: "Simulation Mode", type: "checkbox", value: false },
sb_emulate_rolls: { label: "Emulate rolls", type: "checkbox", value: false },
sb_save_script: { label: "Save Script in txt format", type: "checkbox", value: false },
};
/* For advanced use. Read documentation to learn how to use it */
var NonGUILaunchConfig = (context) => {
ex.stats_logging.median = true;
//ex.stop_on_streak_catch = true;
ex.game_sounds = true;
ex.interval_rolls = 1;
};
var ver = 2.15;
/************************************************************************************************** */
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 minProfit = config.minProfit.value; /* max lose before stop. In bits */
var maxProfit = config.maxProfit.value; /* max profit before stop. In bits */
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 = config.sb_FORCE_STOP_IF_LOWER.value; /* Don't allow balance drop lower than this value. 0 to disable this feature. */
const FULL = 1, NORMAL = 0;
var setup = config.cb_globals.options.SETUP.value; /** Number you set must be in function load_pattern() > switch statement > case with number. */
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
dynamic_risk_factor: config.dynamic_risk_factor.value,
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: config.sb_disable_target_at_bust.value, /* 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: config.sb_stop_on_catch.value,
game_sounds: true, /* Set rule for seed being reset only when all tactics have ended their period */
interval_rolls: 0, /* Pause between rolls */
allow_seed_reset: true,
debug: config.sb_debug_common.value, /* Logging output enabled or disabled */
fast_loading_config: true,
advanced_log: !config.sb_debug.value, /* Logging output for more detailed information, ignores debug value */
reset_browser_stats: true, /* Reset static client stats on script launch */
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)
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 */
},
seed: {change_seed_stw: 100000, change_seed: 20000},
hard_style: {enabled: false, max_loss: -25000, multiplier: 0.08, streak_range: 2},
globals: {LONGEST_DIFFCULTY: 16, PLAY_IN_RANGE: 4, HIT_MIN_PROFIT_TIMES: config.sb_HIT_MIN_PROFIT_TIMES.value, HIT_MAX_PROFIT_TIMES: config.sb_HIT_MAX_PROFIT_TIMES.value }, /* Global properties, which may be a constant value or to change all behavior way Sandbox work */
fast_betting: {enabled: config.fast_betting_enabled.value, wager: config.fast_betting_wager.value, chase: config.fast_betting_chase.value},
stats_logging: {median: false, median_cargo: -1, median_history: false},
testing: {
simulation: config.sb_simulation_mode.value,
simulation_MODE: NORMAL, /* NORMAL - DON'T SHOW TARGET / FULL - SHOW PLACE TARGET */
simulation_balance: config.sb_simulation_balance.value,
clientSeed: "b12cd3se41d600657a59590fb07e78e12a45075aec492061e3a52sa5c0f6057i",
auditSeed: "469cd022ade40d200fded1da1704709db25bba932ca1bf9c74516b4babc61e6e",
gameSeed: "glorious subdued berrys",
},
};
var engine = this
var change_seed_next = setSeed_rules()
var game_array = [], patterns = [], cases = [], history = [], queue = [], log_history = [], rolls_history = [];
var PLAY_HARD = false, skip_enabled = true, downloaded = false;
const RISK_MULTIPLIER_DEFAULT = config.RISK_MULTIPLIER.value;
const RISK_FACTOR_DEFAULT = config.RISK_FACTOR.value;
const RISK_BASE_DEFAULT = config.RISK_BASE.value;
var nonce = 0, PROFIT = 0, TOTAL_BETS = 0, TOTAL_ROLLS = 0, times_won = 0, times_lost = 0,
WINS_OVERALL = 0, session_value = 0, STREAK_ROLL = 0, luck_activation = 0, last_strategy = null,
emulation, queueSize = 5, RUNNING = false, active_playing = 0, cool_down = 10, skipStep = 1; /* 0 = skip | 1 = bet */
var output_message = ``, output_msg = ``, luck_output = ``, output_features = ``;
var median_skips = 8, median_results = [], median_loses = [], vectorApex, median_nextBet, MEDIAN_DEBUG = true, MEDIAN_BET_BALANCE = 0.2;
var diffculty_sleep = ex.interval_rolls;
var _nonce = get_random_nonce();
let nonce_x = async () => { _nonce = _nonce + 1; await sleep(config.sb_test_rolling.value); return _nonce };
//****************************ASSIGN AREA**************************************** */
const origLog = this.log;
const origBet = this.bet;
const origSkip = this.skip;
const origBalance = this.balance;
this.log = function() {
console.log(arguments);
return origLog.apply(this, arguments);
}
this.bet = async function () {
Console.prototype.main();
if (config.sb_emulate_rolls.value) {
emulation = await gameResult(await nonce_x()) / 100;
return { multiplier: emulation };
} else {
return origBet.apply(this, arguments);
}
};
this.skip = async function () {
Console.prototype.main();
if (config.sb_emulate_rolls.value) {
emulation = await gameResult(await nonce_x()) / 100;
return { multiplier: emulation };
} else {
return origSkip.apply(this, arguments);
};
};
this.balance = async function () {
if (config.sb_emulate_rolls.value || ex.testing.simulation) {
return ex.testing.simulation_balance;
} else {
return origBalance.apply(this, arguments);
}
};
const binomialCoefficient = (n, k) => {
if (Number.isNaN(n) || Number.isNaN(k)) return NaN;
if (k < 0 || k > n) return 0;
if (k === 0 || k === n) return 1;
if (k === 1 || k === n - 1) return n;
if (n - k < k) k = n - k;
let res = n;
for (let j = 2; j <= k; j++) res *= (n - j + 1) / j;
return Math.round(res);
};
function get_odds(chance){
return (100 / chance).toFixed(2)
}
//****************************************************************************** */
/* List of launch cases which can be accessed in [F12] > Sandbox Launch cases */
function form_cases() {
new TheCase(0, "Sandbox Script", 0)
new TheCase(1, "RND targets/bets", 50000)
new TheCase(2, "Segmentar for 9.44 with 8 max turns and 8 stw and high various Math.pow", 50000)
new TheCase(3, "For 9.44 with 8 max turns and 8 stw", 50000)
new TheCase(4, "Single safe 4.72x play", 15000)
new TheCase(5, "Many multiplier targets with high multipliers play and risk_multiplier set to 0", 30000)
new TheCase(7, "26.6x playing with chains", 30000)
new TheCase(8, "Target manipulation: 20x to 5x; 5x to 20x; 100x to 35x", 5000)
new TheCase(9, "Target manipulation: 20x to 5x", 5000)
new TheCase(10, "Target 10x with skips", 3000)
new TheCase(11, "Chase nyans of 1000x with changeable basebet on hit wins", 35000)
new TheCase(12, "Chase 10x, 15x, 20x for low balances, non-martingale, 80% of success", 1500)
new TheCase(13, "Chase 5x, 10x, 5x 15x, 5x, 20x, 5x for normal balances, non-martingale, 70% of success", 10000)
new TheCase(14, "Chase 10x, 20x, very risky and insane profiting, increases on hits base bet, 20% of success", 20000)
new TheCase(19, "Soft-play(no chain-chase) for targets 1.3x, 1.5x, 3x.... 10x", 3000)
new TheCase(20, "Soft-play for targets 3x.... 10x", 5000)
new TheCase(21, "Soft-play flat bet with chain-chase for targets 1.3x, 1.5x, 3x.... 10x", 3000)
new TheCase(22, "1.24x playing after 7 in a row", 5000)
new TheCase(100, "100x playing with chain-chase and proximity", 10000)
new TheCase(1000, "From 3x to 1000x targets play with step 1x", 25000)
new TheCase(9999, "Search manual spot with 1.5x under 7 in a row and stop then", 0)
};
/* Syntax to use new Strategy(TARGET, basebet, max turns, STW, multiplier, return_to_base) */
async function load_pattern() {
Sandbox_delete_strategies();
engine.clearLog();
var description = ``;
var cost = `0`;
var listing = ``;
let targets = 9.44; // for some cases common targets setting
let multipliers = 1.2; // for some cases common multipliers setting
let segmentar_betting_sectors = 6;
var base_bets, nyan_target, nyan_bet, chains;
form_cases();
for (let i = 0; i < cases.length; i++){
if (config.cb_globals.options.SETUP.value == cases[i][0]){
description = cases[i][1];
cost = cases[i][2];
engine.log(description);
sleep(1000);
break;
};
};
if (config.cb_globals.value == "sandbox_mode" || config.cb_globals.value == "merged") {
description = `Sandbox mode`
engine.log(description)
await ScriptConstructorArea()
engine.log(`Reading GUI`)
}
if (config.cb_globals.value == "SETUP" || config.cb_globals.value == "merged") {
switch (config.cb_globals.options.SETUP.value){
case 1:
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_to_first_on_hit_win = true
RISK_BASE = 1.0
RISK_FACTOR = 1.0
minProfit = 500 * 100
maxProfit = 500 * 100
ex.globals.HIT_MAX_PROFIT_TIMES = 30
ex.globals.HIT_MIN_PROFIT_TIMES = 30
for (let i = 1; i < segmentar_betting_sectors; i++) {
let rnd_bet = 5
let rnd_target = 16
let rnd_turn = 5
let temp = get_random(1.2) * rnd_target
new Strategy(temp, get_random(1.5) * rnd_bet, get_random(1.2) * rnd_turn, 0, get_formula_multiplier(temp) + RISK_MULTIPLIER, true)
}
Sandbox_do_sort_random()
break;
case 2:
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.6), 8, 8, multipliers)
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.8), 6, 8, multipliers)
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.4), 8, 8, multipliers)
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.7), 6, 8, multipliers)
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.1), 8, 8, multipliers)
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.3), 8, 8, multipliers)
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.5), 8, 8, multipliers)
new Strategy(targets, Math.pow(1 * RISK_BASE, 2.72), 6, 8, multipliers)
break;
case 3:
new Strategy(targets, Math.pow(5, 2.72), 8, 8, multipliers)
new Strategy(targets, Math.pow(6, 2.72), 8, 8, multipliers)
new Strategy(targets, Math.pow(7, 2.72), 8, 8, multipliers)
new Strategy(targets, Math.pow(8, 2.72), 8, 8, multipliers)
new Strategy(targets, Math.pow(9, 2.72), 8, 8, multipliers)
new Strategy(targets, Math.pow(10, 2.72), 8, 8, multipliers)
new Strategy(targets, Math.pow(11, 2.72), 8, 8, multipliers)
new Strategy(targets, Math.pow(12, 2.72), 8, 8, multipliers)
break;
case 4:
RISK_BASE = 1.0
RISK_FACTOR = 1.0
RISK_MULTIPLIER = 0.01
new Strategy(4.72, 2)
break;
case 5:
/* Target arrays: 5x - 25x, risk: multiplier 0.0, base 3.0, factor 0.7 */
for (let i = 0; i < 5; i++) {
RISK_BASE = 1.0
RISK_FACTOR = 1.0
RISK_MULTIPLIER = 0.0
let lower_chase_target = i * 5 + 5
let lower_chase_max_turns = 3 * lower_chase_target // To disable max turns, change value to 0.
new Strategy(lower_chase_target, 1, lower_chase_max_turns, get_stw(lower_chase_target), get_formula_multiplier(lower_chase_target), true)
}
/* Target arrays: 30x - 45x, risk: multiplier 0.0, base 1.0, factor 0.8 */
for (let i = 5; i < 10; i++) {
RISK_BASE = 1.0
RISK_FACTOR = 1.0
RISK_MULTIPLIER = 0.0
new Strategy(i * 5 + 5)
}
/* Target arrays: 50x - 95x, risk: multiplier 0.0, base 1.0, factor 1.2 */
for (let i = 0; i < 9; i++) {
RISK_FACTOR = 1.1
RISK_BASE = 1
RISK_MULTIPLIER = 0.0
new Strategy(i * 5 + 50)
}
/* Target arrays: 100x - 200x, risk: multiplier 0.0, base 1.0, factor 1.0 */
for (let i = 0; i < 10; i++) {
RISK_FACTOR = 1.2
RISK_BASE = 1.0
RISK_MULTIPLIER = 0.0
new Strategy(i * 10 + 100)
}
/* Target arrays: 200x - 450x, risk: multiplier 0.0, base 1.0, factor 1.0 */
for (let i = 0; i < 10; i++) {
RISK_FACTOR = 1.35
RISK_BASE = 1.0
RISK_MULTIPLIER = 0.0
new Strategy(i * 25 + 200)
}
/* Target arrays: 500x - 1000x, risk: multiplier 0.0, base 1.0, factor 1.2 */
for (let i = 0; i < 10; i++) {
RISK_FACTOR = 1.5
RISK_BASE = 1.0
RISK_MULTIPLIER = 0.0
new Strategy(i * 50 + 500)
}
/* Target arrays: 5000x - 10000x, risk: multiplier 0.0, base 1.0, factor 1.3 */
for (let i = 0; i < 10; i++) {
RISK_FACTOR = 2.0
RISK_BASE = 1.0
RISK_MULTIPLIER = 0.0
new Strategy(i * 500 + 5000)
}
RISK_FACTOR = 1.0
RISK_BASE = 1.0
RISK_MULTIPLIER = 0.0
break;
case 7:
ex.analyze_streaks = true
new Strategy(26, 1)
game_array[ 0 ].Settings.modifications.chain_chase.enabled = true
game_array[ 0 ].Settings.modifications.chain_chase.queue_base = 1
break;
case 8:
ex.analyze_streaks = false
RISK_FACTOR = 0.0
let play_20x = true;
let play_5x = true;
let play_100x = false;
if (play_20x) {
new Strategy(20, 1)
game_array[ 0 ].Settings.target.multiplier = 0.95
game_array[ 0 ].Settings.target.maximal = 20
game_array[ 0 ].Settings.target.minimal = 5
game_array[ 0 ].Settings.target.digits_round = 0
game_array[ 0 ].Settings.bet.maximal = 1.2
game_array[ 0 ].Settings.bet.base = 1
game_array[ 0 ].Settings.bet.multiplier = 1.113
game_array[ 0 ].Settings.target.return_at.on_win = true
}
if (play_5x) {
new Strategy(5, 1)
game_array[ 1 ].Settings.target.multiplier = 1.0
game_array[ 1 ].Settings.target.maximal = 4
game_array[ 1 ].Settings.target.minimal = 4
game_array[ 1 ].Settings.target.base = 4
game_array[ 1 ].Settings.bet.maximal = 1.2
game_array[ 1 ].Settings.bet.base = 1
game_array[ 1 ].Settings.bet.multiplier = 1.3
game_array[ 1 ].Settings.target.return_at.on_win = true
}
if (play_100x) {
new Strategy(100, 1)
game_array[ 2 ].Settings.target.multiplier = 0.98
game_array[ 2 ].Settings.target.maximal = 100
game_array[ 2 ].Settings.target.minimal = 35
game_array[ 2 ].Settings.target.digits_round = 0
game_array[ 2 ].Settings.bet.maximal = 0.35
game_array[ 2 ].Settings.bet.base = 1
game_array[ 2 ].Settings.bet.multiplier = 1.015
game_array[ 2 ].Settings.target.return_at.on_win = true
}
for (let i = 0; i < game_array.length; i++) {
game_array[ i ].Settings.modifications.chain_chase.enabled = true
if (game_array[ i ].target > 40) {
game_array[ i ].Settings.modifications.chain_chase.queue = 1
game_array[ i ].Settings.modifications.chain_chase.queue_base = 1
} else {
game_array[ i ].Settings.modifications.chain_chase.queue = 2
game_array[ i ].Settings.modifications.chain_chase.queue_base = 2
}
}
break;
case 9:
ex.analyze_streaks = false;
RISK_FACTOR = 0.0;
new Strategy(20, 1);
game_array[ 0 ].Settings.bet.base = 1;
game_array[ 0 ].Settings.bet.multiplier = 1.1;
game_array[ 0 ].Settings.target.mode = "add";
game_array[ 0 ].Settings.target.multiplier = -1;
game_array[ 0 ].Settings.target.minimal = 5;
game_array[ 0 ].Settings.target.maximal = 20;
game_array[ 0 ].Settings.target.return_at.on_win = true;
break;
case 10:
ex.analyze_streaks = true;
RISK_FACTOR = 1;
RISK_MULTIPLIER = 0;
RISK_BASE = 1;
BET_PERCENT_FROM_BK = 100;
ex.increase_basebet_after_streak = -1;
ex.increase_basebet_on_wins = 0;
ex.increase_basebet_times = 0;
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 ].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;
case 11:
ex.analyze_streaks = false;
RISK_FACTOR = 0.7;
RISK_MULTIPLIER = 0;
RISK_BASE = 1;
BET_PERCENT_FROM_BK = 100;
minProfit = -10000000;
maxProfit = 10000000;
ex.increase_basebet_after_streak = -1;
ex.increase_basebet_on_wins = 200;
ex.increase_basebet_times = 464;
new Strategy(1000, 100, 0, 0, 1, true);
game_array[ 0 ].target = 1000;
game_array[ 0 ].basebet = 300;
game_array[ 0 ].basebet_default = 300;
game_array[ 0 ].bet = 300;
game_array[ 0 ].MAX_BET_TURNS = 0;
game_array[ 0 ].STW = 0;
game_array[ 0 ].enabled = true;
game_array[ 0 ].Settings.bet.multiplier = 1;
game_array[ 0 ].Settings.bet.base = 300;
game_array[ 0 ].Settings.bet.mode = "mul";
game_array[ 0 ].Settings.bet.minimal = 100;
game_array[ 0 ].Settings.bet.maximal = 1000000000;
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 = 1000;
game_array[ 0 ].Settings.target.mode = "mul";
game_array[ 0 ].Settings.target.minimal = 2;
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;
game_array[ 0 ].ACTION = async function () { await strategy_play(this) };
break;
case 12:
ex.analyze_streaks = false;
RISK_FACTOR = 0.7;
RISK_MULTIPLIER = 0;
RISK_BASE = 1;
BET_PERCENT_FROM_BK = 100;
minProfit = -150000;
maxProfit = 200000;
ex.increase_basebet_after_streak = -1;
ex.increase_basebet_on_wins = 40;
ex.increase_basebet_times = 100;
new Strategy(10, 100, 6, 0, 1.2, true);
new Strategy(15, 100, 6, 0, 1.2, true);
new Strategy(20, 100, 6, 0, 1.2, 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 = 6;
game_array[ 0 ].STW = 0;
game_array[ 0 ].enabled = true;
game_array[ 0 ].Settings.bet.multiplier = 1.2;
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 = 1000000000;
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 = 2;
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;
game_array[ 0 ].ACTION = async function () { await strategy_play(this) };
game_array[ 1 ].target = 15;
game_array[ 1 ].basebet = 100;
game_array[ 1 ].basebet_default = 100;
game_array[ 1 ].bet = 100;
game_array[ 1 ].MAX_BET_TURNS = 6;
game_array[ 1 ].STW = 0;
game_array[ 1 ].enabled = true;
game_array[ 1 ].Settings.bet.multiplier = 1.2;
game_array[ 1 ].Settings.bet.base = 100;
game_array[ 1 ].Settings.bet.mode = "mul";
game_array[ 1 ].Settings.bet.minimal = 100;
game_array[ 1 ].Settings.bet.maximal = 1000000000;
game_array[ 1 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 1 ].Settings.bet.return_at.on_win = true;
game_array[ 1 ].Settings.bet.return_at.on_lose = false;
game_array[ 1 ].Settings.target.multiplier = 1;
game_array[ 1 ].Settings.target.base = 15;
game_array[ 1 ].Settings.target.mode = "mul";
game_array[ 1 ].Settings.target.minimal = 2;
game_array[ 1 ].Settings.target.maximal = 10000;
game_array[ 1 ].Settings.target.return_at.return = false;
game_array[ 1 ].Settings.target.return_at.on_win = true;
game_array[ 1 ].Settings.target.return_at.on_lose = false;
game_array[ 1 ].ACTION = async function () { await strategy_play(this) };
game_array[ 2 ].target = 20;
game_array[ 2 ].basebet = 100;
game_array[ 2 ].basebet_default = 100;
game_array[ 2 ].bet = 100;
game_array[ 2 ].MAX_BET_TURNS = 6;
game_array[ 2 ].STW = 0;
game_array[ 2 ].enabled = true;
game_array[ 2 ].Settings.bet.multiplier = 1.2;
game_array[ 2 ].Settings.bet.base = 100;
game_array[ 2 ].Settings.bet.mode = "mul";
game_array[ 2 ].Settings.bet.minimal = 100;
game_array[ 2 ].Settings.bet.maximal = 1000000000;
game_array[ 2 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 2 ].Settings.bet.return_at.on_win = true;
game_array[ 2 ].Settings.bet.return_at.on_lose = false;
game_array[ 2 ].Settings.target.multiplier = 1;
game_array[ 2 ].Settings.target.base = 20;
game_array[ 2 ].Settings.target.mode = "mul";
game_array[ 2 ].Settings.target.minimal = 2;
game_array[ 2 ].Settings.target.maximal = 10000;
game_array[ 2 ].Settings.target.return_at.return = false;
game_array[ 2 ].Settings.target.return_at.on_win = true;
game_array[ 2 ].Settings.target.return_at.on_lose = false;
game_array[ 2 ].ACTION = async function () { await strategy_play(this) };
break;
case 13:
ex.analyze_streaks = false;
RISK_FACTOR = 0.7;
RISK_MULTIPLIER = 0;
RISK_BASE = 1;
BET_PERCENT_FROM_BK = 100;
minProfit = -1000000;
maxProfit = 1000000;
ex.increase_basebet_after_streak = -1;
ex.increase_basebet_on_wins = 1600;
ex.increase_basebet_times = 1001;
new Strategy(5, 100, 3, 0, 1, true);
new Strategy(10, 100, 3, 0, 1, true);
new Strategy(15, 100, 3, 0, 1, true);
new Strategy(10, 100, 3, 0, 1, true);
new Strategy(5, 100, 3, 0, 1, true);
new Strategy(15, 100, 3, 0, 1, true);
new Strategy(15, 100, 3, 0, 1, true);
new Strategy(15, 100, 3, 0, 1, true);
new Strategy(5, 100, 3, 0, 1, true);
new Strategy(20, 100, 3, 0, 1, true);
new Strategy(15, 100, 3, 0, 1, true);
new Strategy(20, 100, 3, 0, 1, true);
game_array[ 0 ].target = 5;
game_array[ 0 ].basebet = 100;
game_array[ 0 ].basebet_default = 100;
game_array[ 0 ].bet = 100;
game_array[ 0 ].MAX_BET_TURNS = 3;
game_array[ 0 ].STW = 0;
game_array[ 0 ].enabled = true;
game_array[ 0 ].Settings.bet.multiplier = 1;
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 = 1000000000;
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 = 5;
game_array[ 0 ].Settings.target.mode = "mul";
game_array[ 0 ].Settings.target.minimal = 2;
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;
game_array[ 0 ].ACTION = async function () { await strategy_play(this) };
game_array[ 1 ].target = 10;
game_array[ 1 ].basebet = 100;
game_array[ 1 ].basebet_default = 100;
game_array[ 1 ].bet = 100;
game_array[ 1 ].MAX_BET_TURNS = 3;
game_array[ 1 ].STW = 0;
game_array[ 1 ].enabled = true;
game_array[ 1 ].Settings.bet.multiplier = 1;
game_array[ 1 ].Settings.bet.base = 100;
game_array[ 1 ].Settings.bet.mode = "mul";
game_array[ 1 ].Settings.bet.minimal = 100;
game_array[ 1 ].Settings.bet.maximal = 1000000000;
game_array[ 1 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 1 ].Settings.bet.return_at.on_win = true;
game_array[ 1 ].Settings.bet.return_at.on_lose = false;
game_array[ 1 ].Settings.target.multiplier = 1;
game_array[ 1 ].Settings.target.base = 10;
game_array[ 1 ].Settings.target.mode = "mul";
game_array[ 1 ].Settings.target.minimal = 2;
game_array[ 1 ].Settings.target.maximal = 10000;
game_array[ 1 ].Settings.target.return_at.return = false;
game_array[ 1 ].Settings.target.return_at.on_win = true;
game_array[ 1 ].Settings.target.return_at.on_lose = false;
game_array[ 1 ].ACTION = async function () { await strategy_play(this) };
game_array[ 2 ].target = 15;
game_array[ 2 ].basebet = 100;
game_array[ 2 ].basebet_default = 100;
game_array[ 2 ].bet = 100;
game_array[ 2 ].MAX_BET_TURNS = 3;
game_array[ 2 ].STW = 0;
game_array[ 2 ].enabled = true;
game_array[ 2 ].Settings.bet.multiplier = 1;
game_array[ 2 ].Settings.bet.base = 100;
game_array[ 2 ].Settings.bet.mode = "mul";
game_array[ 2 ].Settings.bet.minimal = 100;
game_array[ 2 ].Settings.bet.maximal = 1000000000;
game_array[ 2 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 2 ].Settings.bet.return_at.on_win = true;
game_array[ 2 ].Settings.bet.return_at.on_lose = false;
game_array[ 2 ].Settings.target.multiplier = 1;
game_array[ 2 ].Settings.target.base = 15;
game_array[ 2 ].Settings.target.mode = "mul";
game_array[ 2 ].Settings.target.minimal = 2;
game_array[ 2 ].Settings.target.maximal = 10000;
game_array[ 2 ].Settings.target.return_at.return = false;
game_array[ 2 ].Settings.target.return_at.on_win = true;
game_array[ 2 ].Settings.target.return_at.on_lose = false;
game_array[ 2 ].ACTION = async function () { await strategy_play(this) };
game_array[ 3 ].target = 10;
game_array[ 3 ].basebet = 100;
game_array[ 3 ].basebet_default = 100;
game_array[ 3 ].bet = 100;
game_array[ 3 ].MAX_BET_TURNS = 3;
game_array[ 3 ].STW = 0;
game_array[ 3 ].enabled = true;
game_array[ 3 ].Settings.bet.multiplier = 1;
game_array[ 3 ].Settings.bet.base = 100;
game_array[ 3 ].Settings.bet.mode = "mul";
game_array[ 3 ].Settings.bet.minimal = 100;
game_array[ 3 ].Settings.bet.maximal = 1000000000;
game_array[ 3 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 3 ].Settings.bet.return_at.on_win = true;
game_array[ 3 ].Settings.bet.return_at.on_lose = false;
game_array[ 3 ].Settings.target.multiplier = 1;
game_array[ 3 ].Settings.target.base = 10;
game_array[ 3 ].Settings.target.mode = "mul";
game_array[ 3 ].Settings.target.minimal = 2;
game_array[ 3 ].Settings.target.maximal = 10000;
game_array[ 3 ].Settings.target.return_at.return = false;
game_array[ 3 ].Settings.target.return_at.on_win = true;
game_array[ 3 ].Settings.target.return_at.on_lose = false;
game_array[ 3 ].ACTION = async function () { await strategy_play(this) };
game_array[ 4 ].target = 5;
game_array[ 4 ].basebet = 100;
game_array[ 4 ].basebet_default = 100;
game_array[ 4 ].bet = 100;
game_array[ 4 ].MAX_BET_TURNS = 3;
game_array[ 4 ].STW = 0;
game_array[ 4 ].enabled = true;
game_array[ 4 ].Settings.bet.multiplier = 1;
game_array[ 4 ].Settings.bet.base = 100;
game_array[ 4 ].Settings.bet.mode = "mul";
game_array[ 4 ].Settings.bet.minimal = 100;
game_array[ 4 ].Settings.bet.maximal = 1000000000;
game_array[ 4 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 4 ].Settings.bet.return_at.on_win = true;
game_array[ 4 ].Settings.bet.return_at.on_lose = false;
game_array[ 4 ].Settings.target.multiplier = 1;
game_array[ 4 ].Settings.target.base = 5;
game_array[ 4 ].Settings.target.mode = "mul";
game_array[ 4 ].Settings.target.minimal = 2;
game_array[ 4 ].Settings.target.maximal = 10000;
game_array[ 4 ].Settings.target.return_at.return = false;
game_array[ 4 ].Settings.target.return_at.on_win = true;
game_array[ 4 ].Settings.target.return_at.on_lose = false;
game_array[ 4 ].ACTION = async function () { await strategy_play(this) };
game_array[ 5 ].target = 15;
game_array[ 5 ].basebet = 100;
game_array[ 5 ].basebet_default = 100;
game_array[ 5 ].bet = 100;
game_array[ 5 ].MAX_BET_TURNS = 3;
game_array[ 5 ].STW = 0;
game_array[ 5 ].enabled = true;
game_array[ 5 ].Settings.bet.multiplier = 1;
game_array[ 5 ].Settings.bet.base = 100;
game_array[ 5 ].Settings.bet.mode = "mul";
game_array[ 5 ].Settings.bet.minimal = 100;
game_array[ 5 ].Settings.bet.maximal = 1000000000;
game_array[ 5 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 5 ].Settings.bet.return_at.on_win = true;
game_array[ 5 ].Settings.bet.return_at.on_lose = false;
game_array[ 5 ].Settings.target.multiplier = 1;
game_array[ 5 ].Settings.target.base = 15;
game_array[ 5 ].Settings.target.mode = "mul";
game_array[ 5 ].Settings.target.minimal = 2;
game_array[ 5 ].Settings.target.maximal = 10000;
game_array[ 5 ].Settings.target.return_at.return = false;
game_array[ 5 ].Settings.target.return_at.on_win = true;
game_array[ 5 ].Settings.target.return_at.on_lose = false;
game_array[ 5 ].ACTION = async function () { await strategy_play(this) };
game_array[ 6 ].target = 15;
game_array[ 6 ].basebet = 100;
game_array[ 6 ].basebet_default = 100;
game_array[ 6 ].bet = 100;
game_array[ 6 ].MAX_BET_TURNS = 3;
game_array[ 6 ].STW = 0;
game_array[ 6 ].enabled = true;
game_array[ 6 ].Settings.bet.multiplier = 1;
game_array[ 6 ].Settings.bet.base = 100;
game_array[ 6 ].Settings.bet.mode = "mul";
game_array[ 6 ].Settings.bet.minimal = 100;
game_array[ 6 ].Settings.bet.maximal = 1000000000;
game_array[ 6 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 6 ].Settings.bet.return_at.on_win = true;
game_array[ 6 ].Settings.bet.return_at.on_lose = false;
game_array[ 6 ].Settings.target.multiplier = 1;
game_array[ 6 ].Settings.target.base = 15;
game_array[ 6 ].Settings.target.mode = "mul";
game_array[ 6 ].Settings.target.minimal = 2;
game_array[ 6 ].Settings.target.maximal = 10000;
game_array[ 6 ].Settings.target.return_at.return = false;
game_array[ 6 ].Settings.target.return_at.on_win = true;
game_array[ 6 ].Settings.target.return_at.on_lose = false;
game_array[ 6 ].ACTION = async function () { await strategy_play(this) };
game_array[ 7 ].target = 15;
game_array[ 7 ].basebet = 100;
game_array[ 7 ].basebet_default = 100;
game_array[ 7 ].bet = 100;
game_array[ 7 ].MAX_BET_TURNS = 3;
game_array[ 7 ].STW = 0;
game_array[ 7 ].enabled = true;
game_array[ 7 ].Settings.bet.multiplier = 1;
game_array[ 7 ].Settings.bet.base = 100;
game_array[ 7 ].Settings.bet.mode = "mul";
game_array[ 7 ].Settings.bet.minimal = 100;
game_array[ 7 ].Settings.bet.maximal = 1000000000;
game_array[ 7 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 7 ].Settings.bet.return_at.on_win = true;
game_array[ 7 ].Settings.bet.return_at.on_lose = false;
game_array[ 7 ].Settings.target.multiplier = 1;
game_array[ 7 ].Settings.target.base = 15;
game_array[ 7 ].Settings.target.mode = "mul";
game_array[ 7 ].Settings.target.minimal = 2;
game_array[ 7 ].Settings.target.maximal = 10000;
game_array[ 7 ].Settings.target.return_at.return = false;
game_array[ 7 ].Settings.target.return_at.on_win = true;
game_array[ 7 ].Settings.target.return_at.on_lose = false;
game_array[ 7 ].ACTION = async function () { await strategy_play(this) };
game_array[ 8 ].target = 5;
game_array[ 8 ].basebet = 100;
game_array[ 8 ].basebet_default = 100;
game_array[ 8 ].bet = 100;
game_array[ 8 ].MAX_BET_TURNS = 3;
game_array[ 8 ].STW = 0;
game_array[ 8 ].enabled = true;
game_array[ 8 ].Settings.bet.multiplier = 1;
game_array[ 8 ].Settings.bet.base = 100;
game_array[ 8 ].Settings.bet.mode = "mul";
game_array[ 8 ].Settings.bet.minimal = 100;
game_array[ 8 ].Settings.bet.maximal = 1000000000;
game_array[ 8 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 8 ].Settings.bet.return_at.on_win = true;
game_array[ 8 ].Settings.bet.return_at.on_lose = false;
game_array[ 8 ].Settings.target.multiplier = 1;
game_array[ 8 ].Settings.target.base = 5;
game_array[ 8 ].Settings.target.mode = "mul";
game_array[ 8 ].Settings.target.minimal = 2;
game_array[ 8 ].Settings.target.maximal = 10000;
game_array[ 8 ].Settings.target.return_at.return = false;
game_array[ 8 ].Settings.target.return_at.on_win = true;
game_array[ 8 ].Settings.target.return_at.on_lose = false;
game_array[ 8 ].ACTION = async function () { await strategy_play(this) };
game_array[ 9 ].target = 20;
game_array[ 9 ].basebet = 100;
game_array[ 9 ].basebet_default = 100;
game_array[ 9 ].bet = 100;
game_array[ 9 ].MAX_BET_TURNS = 3;
game_array[ 9 ].STW = 0;
game_array[ 9 ].enabled = true;
game_array[ 9 ].Settings.bet.multiplier = 1;
game_array[ 9 ].Settings.bet.base = 100;
game_array[ 9 ].Settings.bet.mode = "mul";
game_array[ 9 ].Settings.bet.minimal = 100;
game_array[ 9 ].Settings.bet.maximal = 1000000000;
game_array[ 9 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 9 ].Settings.bet.return_at.on_win = true;
game_array[ 9 ].Settings.bet.return_at.on_lose = false;
game_array[ 9 ].Settings.target.multiplier = 1;
game_array[ 9 ].Settings.target.base = 20;
game_array[ 9 ].Settings.target.mode = "mul";
game_array[ 9 ].Settings.target.minimal = 2;
game_array[ 9 ].Settings.target.maximal = 10000;
game_array[ 9 ].Settings.target.return_at.return = false;
game_array[ 9 ].Settings.target.return_at.on_win = true;
game_array[ 9 ].Settings.target.return_at.on_lose = false;
game_array[ 9 ].ACTION = async function () { await strategy_play(this) };
game_array[ 10 ].target = 15;
game_array[ 10 ].basebet = 100;
game_array[ 10 ].basebet_default = 100;
game_array[ 10 ].bet = 100;
game_array[ 10 ].MAX_BET_TURNS = 3;
game_array[ 10 ].STW = 0;
game_array[ 10 ].enabled = true;
game_array[ 10 ].Settings.bet.multiplier = 1;
game_array[ 10 ].Settings.bet.base = 100;
game_array[ 10 ].Settings.bet.mode = "mul";
game_array[ 10 ].Settings.bet.minimal = 100;
game_array[ 10 ].Settings.bet.maximal = 1000000000;
game_array[ 10 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 10 ].Settings.bet.return_at.on_win = true;
game_array[ 10 ].Settings.bet.return_at.on_lose = false;
game_array[ 10 ].Settings.target.multiplier = 1;
game_array[ 10 ].Settings.target.base = 15;
game_array[ 10 ].Settings.target.mode = "mul";
game_array[ 10 ].Settings.target.minimal = 2;
game_array[ 10 ].Settings.target.maximal = 10000;
game_array[ 10 ].Settings.target.return_at.return = false;
game_array[ 10 ].Settings.target.return_at.on_win = true;
game_array[ 10 ].Settings.target.return_at.on_lose = false;
game_array[ 10 ].ACTION = async function () { await strategy_play(this) };
game_array[ 11 ].target = 20;
game_array[ 11 ].basebet = 100;
game_array[ 11 ].basebet_default = 100;
game_array[ 11 ].bet = 100;
game_array[ 11 ].MAX_BET_TURNS = 3;
game_array[ 11 ].STW = 0;
game_array[ 11 ].enabled = true;
game_array[ 11 ].Settings.bet.multiplier = 1;
game_array[ 11 ].Settings.bet.base = 100;
game_array[ 11 ].Settings.bet.mode = "mul";
game_array[ 11 ].Settings.bet.minimal = 100;
game_array[ 11 ].Settings.bet.maximal = 1000000000;
game_array[ 11 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 11 ].Settings.bet.return_at.on_win = true;
game_array[ 11 ].Settings.bet.return_at.on_lose = false;
game_array[ 11 ].Settings.target.multiplier = 1;
game_array[ 11 ].Settings.target.base = 20;
game_array[ 11 ].Settings.target.mode = "mul";
game_array[ 11 ].Settings.target.minimal = 2;
game_array[ 11 ].Settings.target.maximal = 10000;
game_array[ 11 ].Settings.target.return_at.return = false;
game_array[ 11 ].Settings.target.return_at.on_win = true;
game_array[ 11 ].Settings.target.return_at.on_lose = false;
game_array[ 11 ].ACTION = async function () { await strategy_play(this) };
break;
case 14:
ex.analyze_streaks = false;
RISK_FACTOR = 0.7;
RISK_MULTIPLIER = 0;
RISK_BASE = 1;
BET_PERCENT_FROM_BK = 100;
minProfit = -1500000;
maxProfit = 2000000;
ex.increase_basebet_after_streak = -1;
ex.increase_basebet_on_wins = 800;
ex.increase_basebet_times = 1000;
new Strategy(10, 100, 9, 0, 1, true);
new Strategy(20, 100, 9, 0, 1, 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 = 9;
game_array[ 0 ].STW = 0;
game_array[ 0 ].enabled = true;
game_array[ 0 ].Settings.bet.multiplier = 1;
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 = 1000000000;
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 = 2;
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;
game_array[ 0 ].ACTION = async function () { await strategy_play(this) };
game_array[ 1 ].target = 20;
game_array[ 1 ].basebet = 100;
game_array[ 1 ].basebet_default = 100;
game_array[ 1 ].bet = 100;
game_array[ 1 ].MAX_BET_TURNS = 9;
game_array[ 1 ].STW = 0;
game_array[ 1 ].enabled = true;
game_array[ 1 ].Settings.bet.multiplier = 1;
game_array[ 1 ].Settings.bet.base = 100;
game_array[ 1 ].Settings.bet.mode = "mul";
game_array[ 1 ].Settings.bet.minimal = 100;
game_array[ 1 ].Settings.bet.maximal = 1000000000;
game_array[ 1 ].Settings.bet.return_at.RETURN_BASE = true;
game_array[ 1 ].Settings.bet.return_at.on_win = true;
game_array[ 1 ].Settings.bet.return_at.on_lose = false;
game_array[ 1 ].Settings.target.multiplier = 1;
game_array[ 1 ].Settings.target.base = 20;
game_array[ 1 ].Settings.target.mode = "mul";
game_array[ 1 ].Settings.target.minimal = 2;
game_array[ 1 ].Settings.target.maximal = 10000;
game_array[ 1 ].Settings.target.return_at.return = false;
game_array[ 1 ].Settings.target.return_at.on_win = true;
game_array[ 1 ].Settings.target.return_at.on_lose = false;
game_array[ 1 ].ACTION = async function () { await strategy_play(this) };
break;
case 19:
RISK_BASE = 2 // Next targets will start game with RB: 2
/* Creating Individual properties for current case. */
let base_bet = 100 // Base bet for all targets in satoshi.
let nyan_targets = 1000 // Try catch this target, after normal target has finished playing.
let nyan_bets = 300 // In satoshi bet amount for specified target after normal target finished playing.
let max_bet_multiplier = 1.5 // Amount to multiply to specify max bet in bits for each target by fdormula [max_bet_multiplier * target].
/* Individual STW features for this case. */
ex.analyze_streaks = true;
/* Adding low targets [1.1x, 1.2x, 1.3x] */
new Strategy(1.1, base_bet, 1).PRE_ROLL = async function () {await engine.bet(nyan_bets, 20)};
new Strategy(1.2, base_bet, 3).PRE_ROLL = async function () {await engine.bet(nyan_bets, 20)};
new Strategy(1.3, base_bet, 3).PRE_ROLL = async function () {await engine.bet(nyan_bets, 20)};
/* Adding low targets [1.3x, 1.5x] */
new Strategy(1.3, base_bet * 5, 0, 5).PRE_ROLL = async function () {await engine.bet(nyan_bets, 20)};
new Strategy(1.5, base_bet * 10, 0, 7).PRE_ROLL = async function () {await engine.bet(nyan_bets, 20)};
/* Adding low targets [3x, 4x, 5x, 6x, 7x, 8x, 9x, 10x] with also defined property .PRE_ROLL which is executing function, */
/* for betting single bet, with targeting 1000x(or any other if you will set). */
new Strategy(3, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
new Strategy(4, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
new Strategy(5, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
new Strategy(6, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
new Strategy(7, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
new Strategy(8, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
new Strategy(9, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
new Strategy(10, base_bet).PRE_ROLL = async function () {await engine.bet(nyan_bets, nyan_targets)};
/* Looping through game_array(holder of each target strategy we created) */
for (let i = 0; i < game_array.length; i++) { // Get all created target length amount.
game_array[ i ].Settings.bet.maximal = max_bet_multiplier * game_array[i].target // In bits we set maximal bet amount with hard-coded formula for each target.
};
/* breaking is necessary to say sandbox what we have finished create our build. */
break;
case 20:
/* Creating Individual properties for current case. */
/* base_bets = 100 // Base bet for all targets in satoshi.
nyan_target = 1000 // Try catch this target, after normal target has finished playing.
nyan_bet = 500 // In satoshi bet amount for specified target after normal target finished playing.
chains = 2 // Chains for targets.
/* Individual STW features for this case. */
ex.analyze_streaks = true;
/* Adding low targets [1.1x, 1.2x, 1.3x] */
//new Strategy(1.1, base_bets, 1).PRE_ROLL = async function () {await engine.bet(nyan_bet, 20)};
//new Strategy(1.2, base_bets, 3).PRE_ROLL = async function () {await engine.bet(nyan_bet, 20)};
//new Strategy(1.3, base_bets, 3).PRE_ROLL = async function () {await engine.bet(nyan_bet, 20)};
/* Adding low targets [1.3x, 1.5x] */
//new Strategy(1.3, base_bets * 5, 0, 5).PRE_ROLL = async function () {await engine.bet(nyan_bet, 20)};
//new Strategy(1.5, base_bets * 10, 0, 7).PRE_ROLL = async function () {await engine.bet(nyan_bet, 20)};
/*
Adding low targets [3x, 4x, 5x, 6x, 7x, 8x] with also defined property .PRE_ROLL which is executing function
for betting single bet, with targeting 1000x(or any other if you will set).
*/
//RISK_BASE = 2; // Next targets will start game with RB: 0.1
/*
new Strategy(3, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(4, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
// RISK_BASE = 0.2; // Next targets will start game with RB: 0.2
new Strategy(5, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(6, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(7, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(8, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
// RISK_BASE = 0.4; // Next targets will start game with RB: 0.4
/*
Adding low targets [9x, 10x] with also defined property .PRE_ROLL which is executing function
for betting single bet, with targeting 1000x(or any other if you will set).
*/
/*
new Strategy(9, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(10, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(11, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(12, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(13, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(14, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(15, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(16, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(17, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(18, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(19, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(20, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
/* Looping through game_array(holder of each target strategy we created) */
/* for (let i = 0; i < game_array.length; i++) { // Get all created target length amount.
game_array[ i ].Settings.modifications.chain_chase.enabled = false // Enabled chain-chase for element we loop through game_array(which holding all created targets).
game_array[ i ].Settings.modifications.chain_chase.queue = chains
game_array[ i ].Settings.modifications.chain_chase.queue_base = chains
game_array[ i ].Settings.bet.maximal = get_max_bet_size(game_array[ i ]) / 2 // In bits we set maximal bet amount with hard-coded formula for each target.
};*/
/* Excluding specified targets from having chain chase feature. IDs = 0, 1, which is same as targets 1.3x, 1.5x */
/* breaking is necessary to say sandbox what we have finished create our build. */
for (let i = 3; i < 10; i++){
new Strategy(i)
}
break;
case 21:
/* Creating Individual properties for current case. */
base_bets = 100 // Base bet for all targets in satoshi.
nyan_target = 1000 // Try catch this target, after normal target has finished playing.
nyan_bet = 1000 // In satoshi bet amount for specified target after normal target finished playing.
chains = 5 // Chains for targets.
/* Individual STW features for this case. */
ex.analyze_streaks = true;
/* Adding low targets [1.3x, 1.5x] */
new Strategy(1.3, base_bets * 5, 0, 5).PRE_ROLL = async function () {await engine.bet(nyan_bet, 20)};
new Strategy(1.5, base_bets * 10, 0, 7).PRE_ROLL = async function () {await engine.bet(nyan_bet, 20)};
/*
Adding low targets [3x, 4x, 5x, 6x, 7x, 8x] with also defined property .PRE_ROLL which is executing function
for betting single bet, with targeting 1000x(or any other if you will set).
*/
RISK_BASE = 0.1; // Next targets will start game with RB: 0.1
new Strategy(3, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(4, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
RISK_BASE = 0.2; // Next targets will start game with RB: 0.2
new Strategy(5, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(6, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(7, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(8, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
RISK_BASE = 0.4; // Next targets will start game with RB: 0.4
/*
Adding low targets [9x, 10x] with also defined property .PRE_ROLL which is executing function
for betting single bet, with targeting 1000x(or any other if you will set).
*/
new Strategy(9, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
new Strategy(10, base_bets).PRE_ROLL = async function () {await engine.bet(nyan_bet, nyan_target)};
/* Looping through game_array(holder of each target strategy we created) */
for (let i = 0; i < game_array.length; i++) { // Get all created target length amount.
game_array[ i ].Settings.modifications.chain_chase.enabled = true // Enabled chain-chase for element we loop through game_array(which holding all created targets).
game_array[ i ].Settings.modifications.chain_chase.queue = chains
game_array[ i ].Settings.modifications.chain_chase.queue_base = chains
game_array[ i ].Settings.bet.maximal = 10 // In bits we set maximal bet amount with hard-coded formula for each target.
};
/* Excluding specified targets from having chain chase feature. IDs = 0, 1, which is same as targets 1.3x, 1.5x */
game_array[ 0 ].Settings.modifications.chain_chase.enabled = false // No chain-chase for target: 1.3x.
game_array[ 1 ].Settings.modifications.chain_chase.enabled = false // No chain-chase for target: 1.5x.
/* breaking is necessary to say sandbox what we have finished create our build. */
break;
case 22:
new Strategy(1.24, 300, 1, 7, get_formula_multiplier(1.24),true)
break;
case 100:
ex.analyze_streaks = true;
new Strategy(100, 100, 0, 0);
game_array[0].proximity = 0.85;
game_array[0].Settings.modifications.chain_chase.enabled = true;
game_array[0].Settings.modifications.chain_chase.queue_base = 3;
patterns.push(new Pattern([-1.01], 1, async (...[context]) => {
strategy_play(game_array[0])
}, this));
break;
case 1000:
for (let i = 3; i < 1000; i++){
new Strategy(i)
}
break;
case 9999:
ex.analyze_streaks = true;
ex.stop_on_streak_catch = true;
ex.debug = true;
ex.advanced_log = true;
new Strategy(1.5, 100, 0, 7);
break;
}
}
if (description != `Sandbox mode` && !ex.fast_loading_config){
await sleep(200)
}
/* Launch pasted code in first text field */
if (config.cb_globals.options.SETUP.value == -1 || config.PASTE_CASE.value != `Paste raw text [see F12]`) {
eval("{" + config.PASTE_CASE.value + "}")
}
if (!config.sb_simulation_mode.value && config.sb_emulate_rolls.value) {
ex.testing.simulation_balance = engine.balance / 100
}
if (!ex.fast_loading_config && config.cb_globals.options.SETUP.value != 0) {
engine.log(`Setup [${setup}] [${description}] [${cost}] being initialized.`)
engine.log(`There is list of ${game_array.length} strategies will play:`)
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)
}
console.log(listing)
engine.log(listing)
}
}
/* Syntax to use 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
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 };
engine.log(`Constructing Script`)
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_base_target`) {
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}`)
}
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 == 0) { sm_mul = get_formula_multiplier(numArray[ i ]) }
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}`)
}
}
//let isBustable = await check_bustable(ex.testing.clientSeed, ex.testing.auditSeed, ex.testing.gameSeed, 200, true, true, 0)
};
/* Allign GUI to Script logic. */
async function ScriptMasterizeArea(number) {
/* Bet */
game_array[ number ].Settings.bet.base = game_array[ number ].basebet_default
game_array[ number ].Settings.bet.maximal = config.sb_bets_maximal.value / 100
game_array[ number ].Settings.bet.minimal = config.sb_bets_minimal.value / 100
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") {
let temp_mul = config.cb_bets_modes.options.mul.value
if (temp_mul == 0) {
temp_mul = get_formula_multiplier(game_array[ number ].target)
}
game_array[ number ].Settings.bet.multiplier = temp_mul
}
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[ number ].Settings.modifications.median.enabled) {
ex.analyze_streaks = true
game_array[ number ].ACTION = await median_loop(game_array[ number ])
}
if (game_array[ number ].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 = new Pullee(target_base, target_base, target_max, target_power);
let bet_pull = new Pullee(bet_base, bet_base, bet_max, bet_power);
game_array[ number ].ACTION = await strategy_pullee(bet_pull, target_pull)
};
};
/* Form prompt for save file with selected information. */
function downloadString(text, fileType, fileName) {
var blob = new Blob([ text ], { type: fileType });
var a = document.createElement('a');
a.download = fileName;
a.href = URL.createObjectURL(blob);
a.dataset.downloadurl = [ fileType, a.download, a.href ].join(':');
a.style.display = "none";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
setTimeout(function () { URL.revokeObjectURL(a.href); }, 1500);
};
/* Download CSV table history of rolls */
function downloadRolls() {
let output;
for (let item in rolls_history){
output += item.join(`,`)
}
downloadString(rolls_history.join(), `text/csv`, `rolls_history.csv`)
};
/* HARD_STYLE TABLE for maximum profit, ps not using it anymore. */
var bet_levels_hard_hit_mod = {
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 ${ex.testing.simulation_balance / 100}`)
balance = ex.testing.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 ].Settings.bet.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 * ex.globals.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 ].Settings.bet.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 * ex.globals.LONGEST_DIFFCULTY)
solution_found = false
while (!solution_found) {
turns++
last_bet_size = bet_size
bet_size *= game_array[ i ].Settings.bet.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);
/* Generate emulated roll. */
async function gameResult(nonce) {
let shaObj = new jsSHA("SHA-256", "TEXT");
shaObj.setHMACKey(ex.testing.auditSeed, "HEX");
shaObj.update(`${ex.testing.gameSeed}|${ex.testing.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));
};
/**
* Emulate test for bust.
* @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 = ex.testing.clientSeed, auditSeed = ex.testing.auditSeed, gameSeed = ex.testing.gameSeed, endNonce = get_random_nonce(), debug_verifier = true, debug_stats = true, startNonce = 1) {
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
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`);
}
let profit = 0
let gs_num = 0
let gs_bet = config.sb_base_bet.value
let gs_balance = 20000 * 100
for (let i = startNonce; i < endNonce; i++) {
let result = await gameResult(i) / 100;
i_played = i
if (debug_verifier) engine.log(`${i} | ${result} | ${(gs_balance / 100).toFixed(2)} bits`);
if (result >= game_array[ gs_num ].target) {
won++
profit += (game_array[ gs_num ].target - 1) * gs_bet
gs_balance += (game_array[ gs_num ].target - 1) * gs_bet
gs_bet = config.sb_base_bet.value
gs_num++
} else {
loss++
profit -= gs_bet
gs_balance -= gs_bet
gs_bet *= config.cb_bets_modes.options.mul.value
}
if (gs_num >= game_array.length) {
gs_num = 0
}
}
if (debug_stats) {
engine.log(`Net Profit: ${(profit / 100).toFixed(2)}`);
engine.log(`Balance: ${(gs_balance / 100).toFixed(2)}`);
engine.log(`Games played ${i_played} rolls`);
engine.log(`wons = ${won}; loss = ${loss};`)
}
return true
};
/**
* Sandbox Constructor - Orders all targets go online.
*/
function Sandbox_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.`)
}
}
Sandbox_do_sort_decremental()
};
/**
* Sandbox Constructor - Sort strategies randomly, works only when RISK_FACTOR set to 0.
*/
function Sandbox_do_sort_random() {
game_array.sort(function (a, b) { return 0.5 - Math.random() });
};
/**
* Sandbox Constructor - Sort strategies incremental in amount of target, from low to high, works only when RISK_FACTOR set to 0.
*/
function Sandbox_do_sort_incremental() {
game_array.sort(function (a, b) { return a.target - b.target });
};
/**
* Sandbox Constructor - Sort strategies decremental in amount of target, from high to low, works only when RISK_FACTOR set to 0.
*/
function Sandbox_do_sort_decremental() {
game_array.sort(function (a, b) { return b.target - a.target });
};
/**
* Sandbox Constructor - Sort strategies decremental by bet size in memory, from high to low, works only when RISK_FACTOR set to 0.
*/
function Sandbox_do_sort_bet_size_decremental(arr = game_array) {
arr.sort(function (a, b) { return b.bet - a.bet });
};
/**
* Sandbox Constructor - Erasing list of existing games.
*/
function Sandbox_delete_strategies(arr = game_array) {
if (arr.length > 0){
engine.log(`List of strategies is erased now.`);
arr => { arr = [] }
} else {
engine.log(`Strategy list already empty.`);
};
};
/**
* Sandbox Constructor - Orders strategy go to offline.
**/
function Sandbox_kill_strategy(game_type) {
game_type.enabled = false
engine.log(`Strategy ${game_type.target} was set to ${game_type.enabled}`)
};
/* Sandbox Constructor - Set all strategies bets return to base. */
function Sandbox_set_return_to_base(isOn = false) {
for (let i = 0; i < game_array.length; i++) {
game_array[ i ].Settings.bet.return_at.RETURN_BASE = isOn;
}
};
/* Sandbox Constructor - Set max bet turns to infinity amount. */
function Sandbox_off_max_bet_turns() {
for (let i = 0; i < game_array.length; i++) {
game_array[ i ].MAX_BET_TURNS = 0
}
};
/* Sandbox Method - Returns current ID of current running strategy. */
function Sandbox_currentPlaying() {
if (active_playing === undefined || active_playing == undefined){
return 0
} else {
return active_playing
}
};
function reset_to_first_strategy() {
if (ex.reset_to_first_on_hit_win) {
RUNNING = true
active_playing = 0
}
};
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_browser_stats) {engine.resetStatistics()}
await load_pattern();
if (ex.calculate_base) {await calculate_bankroll()};
if (NonGUILaunchConfig != null) {NonGUILaunchConfig(engine)};
//engine.clearLog()
engine.log('Script.......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
}
}
}
// //await updateLog();
};
function Summary(streak_count) {
let main_number_who_trigger = 9.44
let current_streak = streak_count
let STYLE_PLAY = ex.globals.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 && ex.debug) {
engine.log(`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
}
function log_times_lost() {
engine.log(`${output_msg}`)
if (ex.globals.HIT_MIN_PROFIT_TIMES > 1) {
engine.log(`Script bust ${times_lost}/${ex.globals.HIT_MIN_PROFIT_TIMES} times, Winning ${times_won} times`)
}
}
/**
* 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) * ex.globals.LONGEST_DIFFCULTY / ex.globals.PLAY_IN_RANGE * UPDATED_RISK_FACTOR)
}
}
} else {
for (let i = 0; i < game_array.length; i++) {
game_array[ i ].STW = 0
}
}
}
function getMedian(){
return log_history.median(log_history).toFixed(2)
}
function UpdateRisksMedian(){
let UPDATED_RISK_FACTOR = config.RISK_FACTOR.value
if (ex.dynamic_risk_factor){
if (getMedian() <= 1.94){
UPDATED_RISK_FACTOR = UPDATED_RISK_FACTOR + 0.3
}
if (getMedian() > 1.94){
UPDATED_RISK_FACTOR = UPDATED_RISK_FACTOR + 0.2
}
if (getMedian() > 1.96){
UPDATED_RISK_FACTOR = UPDATED_RISK_FACTOR + 0.1
}
if (getMedian() > 2.0){
UPDATED_RISK_FACTOR = UPDATED_RISK_FACTOR
}
if (getMedian() > 2.1){
UPDATED_RISK_FACTOR = UPDATED_RISK_FACTOR - 0.1
}
if (getMedian() > 2.15){
UPDATED_RISK_FACTOR = UPDATED_RISK_FACTOR - 0.2
}
for (let i = 0; i < game_array.length; i++) {
game_array[ i ].STW = Math.round((game_array[ i ].target * ex.mul_target) * ex.globals.LONGEST_DIFFCULTY / ex.globals.PLAY_IN_RANGE * UPDATED_RISK_FACTOR)
}
}
}
/**
* Updates all output logging.
*/
async function updateLog() {
let other_output = ``
let median_output = ``
engine.clearLog()
log_times_lost()
if (ex.stats_logging.median && log_history != undefined) {
if (ex.stats_logging.median_history) { console.log(`History of latest ${ex.stats_logging.median_cargo} games: ${log_history}`) }
median_output = ` | Median: ${getMedian()}`
if (log_history.length >= ex.stats_logging.median_cargo && ex.stats_logging.median_cargo != -1) { log_history = [] }
}
if (ex.luck_usage) { engine.log(`Luck: ${get_luck(game_array[active_playing])}% | 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}`)
if (ex.advanced_log) {
engine.log(output_message)
other_output = await stats_show() + ` | `
}
engine.log(other_output + `Profit: ${(PROFIT / 100).toFixed(2)} bits` + median_output )
if (ex.advanced_log) { features_logging() }
if (ex.debug && ex.hard_style.enabled && PLAY_HARD) engine.log('HARD-PLAY MODE!')
if (config.sb_simulation_mode.value || config.sb_emulate_rolls.value) {
engine.log(`Balance ${Math.round(ex.testing.simulation_balance / 100)} bits`)
if (ex.testing.simulation_balance <= 0) {
engine.log(`Game Over`)
await engine.stop()
}
}
UpdateRisksMedian()
}
function get_luck(game_strategy = Strategy()) {
let luck = calculateLuck(TOTAL_BETS, WINS_OVERALL, game_strategy.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. */
async function stats_show(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(get_winning_rate(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 ].Settings.bet.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
times_won++
if (ex.globals.HIT_MIN_PROFIT_TIMES == 0 || times_won >= ex.globals.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 {
times_lost++
if (times_lost >= ex.globals.HIT_MIN_PROFIT_TIMES) {
await engine.log(`Script lost ${times_lost} times, so it is stopping`)
await engine.stop()
} else {
output_msg = `Script lost once more and now ${times_lost}/${ex.globals.HIT_MIN_PROFIT_TIMES} before stop`
PROFIT = 0
session_value = 0
//await generateSeed() // Dont change seed at target bust
if (ex.disable_target_at_bust) Sandbox_kill_strategy(game_strategy)
}
}
}
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.max(100, Math.round(bet / 100) * 100);
}
/**
* Sandbox Constructor - Returns multiplier with calculated RISK_MULTIPLIER.
* @param {number} target
*/
function get_formula_multiplier(target) {
return (1 / (target - 1) + 1) + (RISK_MULTIPLIER * (1 / (target - 1) + 1))
};
function get_longest_streak(target) {
return Math.round(target * ex.globals.LONGEST_DIFFCULTY)
};
function get_stw(target) {
if (RISK_FACTOR == 0) {
return 0
} else {
return Math.round(get_longest_streak(target) / ex.globals.PLAY_IN_RANGE * RISK_FACTOR)
}
};
function get_winning_rate(wins, games) {
return Math.round((wins / games) * 100).toFixed(2)
};
function get_max_bet_size(game_strategy = Strategy()){
let target = game_strategy.target
return (((target * ex.globals.LONGEST_DIFFCULTY) - (((target * ex.globals.LONGEST_DIFFCULTY) / ex.globals.PLAY_IN_RANGE) * RISK_FACTOR)) * target) / game_strategy.Settings.modifications.chain_chase.queue_base
};
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 get_random_nonce(rnd = 10000000) {
return Math.round(Math.random()* rnd)
}
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 (!ex.testing.simulation) {
await engine.bet(ex.session_game.sessionBet, ex.session_game.sessionTarget)
} else {
if (ex.testing.simulation_MODE == FULL) {
var { multiplier } = await engine.bet(100, ex.session_game.sessionTarget)
new Roll(100, 1.01, multiplier)
} else {
var { multiplier } = await engine.bet(100, 1.01)
new Roll(100, 1.01, multiplier)
}
if (multiplier < ex.session_game.sessionTarget) {
ex.testing.simulation_balance -= ex.session_game.sessionBet
} else {
ex.testing.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 * times_won)) {
temp = ex.session_game.sessionBet + (ex.session_game.sessionBet * times_won)
}
}
}
return temp
}
/* Attributes - Target */
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 */
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 && config.cb_globals.value == "sandbox_mode") {
if (multiplier >= game_strategy.target) { //Win behavior
if (game_strategy.Settings.bet.return_at.on_win && !game_strategy.Settings.modifications.chain_chase.enabled && game_strategy.Settings.modifications.chain_chase.queue <= 0) {
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 { // 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.Settings.bet.multiplier
}
return
}
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)
new Roll(100, 1.01, 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
}
}
}
class Pullee {
constructor(base, base2, max, power) {
this.base = base
this.base2 = base2
this.max = max
this.power = power
this.CreatePullee(base, base2, max, power)
}
/* Power functions modification - Can create using a single number as an argument, and modify later if needed */
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;
};
};
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);
};
};
class TheCase {
constructor(ID, description, cost) {
this._ID = ID;
this._description = description;
this._cost = cost;
cases.push([ID, description, cost]);
}
get length(){
return cases.length
};
get ID(){
return this._ID
};
get description(){
return this._description
};
get cost(){
return this._cost
};
};
class Roll {
constructor(bet, target, multiplier){
this.timestamp = this.currentTime
this.bet = Math.round(bet)
this.target = target
this.outcome = multiplier
rolls_history.push([rolls_history.length, this.bet, this.target, this.outcome, this.timestamp])
log_history.push(multiplier)
this.update()
}
get currentTime(){
this.hours = new Date().getHours()
this.minutes = new Date().getMinutes()
return `${this.hours}:${this.minutes}`
}
async update(){
await updateLog()
}
}
async function strategy_play(game_strategy = Strategy()) {
// INITIALIZATIONS
var cycles_activation = 0
let RETRY = true
// CONDITIONS
if (game_strategy.LS < game_strategy.STW) return
// CONDITIONS - INITIALIZATIONS
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) {
await SE.sound_loop(9)
engine.log(`Stopped due option stop_on_streak_catch = true, catched target ${last_strategy}x.`)
engine.stop()
}
/* Checking conditions before bet and change bet if need */
if (game_strategy.Settings.bet.return_at.RETURN_BASE == true) {
game_strategy.bet = game_strategy.basebet
}
while (RETRY) {
// PLAYING PHASE
if (game_strategy.STREAK_ROLL >= game_strategy.MAX_BET_TURNS && game_strategy.MAX_BET_TURNS != 0) {
/* Checking conditions before bet */
if (game_strategy.Settings.bet.return_at.RETURN_BASE) {
game_strategy.bet = game_strategy.basebet
} else {
RETRY = false
await updateLog()
return
}
}
/* Checking if game in simulation mode */
if (!ex.testing.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);
new Roll(game_strategy.bet, game_strategy.target, multiplier);
} else {
let simulation_target = 1.01
if (ex.testing.simulation_MODE == FULL) {
simulation_target = game_strategy.target;
} else {
simulation_target = 1.01;
}
var { multiplier } = await engine.bet(100, simulation_target);
new Roll(game_strategy.bet, game_strategy.target, multiplier);
if (game_strategy.LastGameWon(multiplier)){
//ex.testing.simulation_balance += ((game_strategy.bet + session_start(game_strategy)) * game_strategy.target)
ex.testing.simulation_balance += increase_profit(game_strategy)
} else {
ex.testing.simulation_balance -= decrease_profit(game_strategy)
//ex.testing.simulation_balance -= (game_strategy.bet + session_start(game_strategy))
}
};
//await this.sound_beat(multiplier, false, game_strategy.target)
SE.sound_loop(8)
TOTAL_BETS++
TOTAL_ROLLS++
nonce++
/* Logic for winning or losing strategy run */
if (game_strategy.LastGameWon(multiplier)) {
/* [Wins] - [Block] */
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--
game_strategy.STREAK_ROLL++ // Possible bug fix if it will be here
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
}
} 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
}
}
}
game_strategy.CYCLES_PAST = 0
WINS_OVERALL++
if (!game_strategy.Settings.bet.return_at.RETURN_BASE) {
ex.allow_seed_reset = true // if return base is set to false, then we allow change seed as period is ended
}
if (game_strategy.target == game_array[ game_array.length - 1 ].target && ex.increase_STW_by_same_targets) {
game_strategy.STW++
}
if (PLAY_HARD) hit_hard(false) //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 (ex.reset_STW_after_game_pass) await updateStreaks(multiplier)
reset_to_first_strategy()
} else {
/* [Lose] - [Block] */
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
cycles_activation = 0
}
}
if (!game_strategy.Settings.bet.return_at.RETURN_BASE) {
ex.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
}
}
// [Start] [Attribute] Sector
//
/* [Attribute] - [Betting] */
betting_attribute(game_strategy, multiplier)
/* [Attribute] - [Targeting] */
target_attributes(game_strategy, multiplier)
/* [Attribute] - Features - [Luck] */
if (ex.winning_frequency) { // Luck Set
luck_activation = calculateLuck(TOTAL_BETS, WINS_OVERALL, game_strategy.target).toFixed(2)
game_strategy.Settings.bet.base /= 2
}
if (get_luck(game_strategy) < 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()
}
//
// [Attribute] - Features - [Probability]
//
//let chance = ProbRun(rolls, game_strategy.STREAK_ROLL, 1 / game_strategy.target)
//engine.log(`Probability: ${(chance*100).toFixed(2)}%`)
// [Attribute] - Features - [Special]
if (!ex.reset_STW_after_game_pass) await updateStreaks(multiplier)
Summary(game_strategy.STREAK_ROLL)
// [Attribute] - Features - [Conditions]
if (PROFIT > maxProfit + (maxProfit * times_won) || 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
}
//
// [End] [Attribute] Sector
// //await updateLog()
};
// AFTER PLAY AREA
if (game_strategy.STREAK_ROLL >= ex.increase_basebet_after_streak && ex.increase_basebet_times > 0 && ex.increase_basebet_after_streak != -1) {
game_strategy.basebet += ex.increase_basebet_on_wins
game_strategy.basebet_default = game_strategy.basebet
ex.increase_basebet_times--
}
// //await updateLog()
// Additional action being executed after main part of logic finished strategy playing
await game_strategy.PRE_ROLL();
};
/**
* 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 sats.
* @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 {number} 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 = 100, max_bet_turns = 0, STW = get_stw(target), multiplier = get_formula_multiplier(target), return_base = true) {
/* Object Main Properties || target, base bet, bet, max bet turns, stw, multiplier || enabled */
this.target = target;
this.basebet = basebet * RISK_BASE;
/* this.basebet_default = () => {
if (config.sb_cb_base_bet_percent.value){
return engine.balance * (config.sb_base_bet_percent.value / 200)
} else {
return basebet * RISK_BASE;
}
}*/
this.basebet_default = basebet * RISK_BASE;
this.bet = basebet * RISK_BASE;
this.MAX_BET_TURNS = max_bet_turns;
this.STW = STW;
this.enabled = true;
/* Object Triggers || ACTION, PRE_ROLL */
this.ACTION = async () => { await strategy_play(this) };
this.PRE_ROLL = async () => { }; // {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;
this.Settings = {
/* Object Bet Attributes || bet: multiplier, base, mode(mul/add), minimal, maximal, return_at(RETURN_BASE, on_win, on_lose) */
bet: {
multiplier: multiplier,
base: basebet * RISK_BASE,
mode: `mul`, /* mul - multiply, add - static additional */
minimal: basebet * RISK_BASE,
_maximal: engine.balance * BET_PERCENT_FROM_BK / 100,
get maximal() {
return this._maximal
},
set maximal(val) {
this._maximal = val * BET_PERCENT_FROM_BK,
engine.log(`Strategy ${target}x; Maximal bet size is set to ${Math.floor(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,
mode: `mul`, /* mul - multiply, add - static additional */
minimal: target,
maximal: 100000,
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: 3,
min_cut: 1.08,
max_cut: 1.25,
},
pullee: {
enabled: false,
power: 0.15,
}
}
};
this.printStatus = () => {
let status_output = ``;
if (Strategy().Settings.modifications.chain_chase.enabled) {
status_output += `Modifications/ChainChase/${Strategy().Settings.modifications.chain_chase.enabled}\n`;
}
if (Strategy().Settings.modifications.median.enabled) {
status_output += `Modifications/Median/${Strategy().Settings.modifications.median.enabled}\n`;
}
if (Strategy().Settings.modifications.pullee.enabled) {
status_output += `Modifications/Pullee/${Strategy().Settings.modifications.pullee.enabled}\n`;
}
console.log(status_output);
return status_output;
};
this.multiplier = (type_attribute = "bet") => {
if (type_attribute == "bet"){
return Strategy().Settings.bet.multiplier;
};
if (type_attribute == "target"){
return Strategy().Settings.target.multiplier;
};
};
this.LastGameWon = (outcome) => {
if (outcome >= target){
return true;
} else {
return false;
};
};
game_array.push(this);
};
/* 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[ i ].Settings.bet.multiplier = (1 / ((game_array[ i ].target) - 1) + 1) + (ex.hard_style.multiplier * (1 / ((game_array[ i ].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[ i ].Settings.bet.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()
}
};
/* Set seed rules for various type of games. */
function setSeed_rules() {
let new_seed_rule
if (RISK_FACTOR == 0) {
new_seed_rule = ex.seed.change_seed
} else {
new_seed_rule = ex.seed.change_seed_stw
}
engine.log(`Set new rules for seed changing ${new_seed_rule}`)
return new_seed_rule
};
/* Generate new seed pair for server hash and client seed. */
async function generateSeed() {
if (ex.luck_usage) {luck_activation = get_luck()}
try {
const { server_seed_hash } = await engine.newSeedPair()
await engine.setClientSeed(server_seed_hash)
}
catch (e) { console.log(`Seed Pair is already was set and still not used.`) }
};
/* Sleep with changing interval overtime */
var sleep_decreasing_interval_flag_reverse = false;
async function sleep_decreasing_interval(mode = false) {
if (mode){
if (diffculty_sleep > 0 && sleep_decreasing_interval_flag_reverse){
diffculty_sleep -= 1
} else {
sleep_decreasing_interval_flag_reverse = !sleep_decreasing_interval_flag_reverse
}
if (diffculty_sleep <= 0 && !sleep_decreasing_interval_flag_reverse) {
diffculty_sleep += 1
} else {
sleep_decreasing_interval_flag_reverse = !sleep_decreasing_interval_flag_reverse
}
} 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 type betting. */
async function strategy_pullee(bet_pull, target_pull) {
//let target = target_pull
//let bet = bet_pull
while (true) {
if (nonce >= change_seed_next && change_seed_next != 0) {
await generateSeed()
nonce = 0
} else { nonce++, TOTAL_ROLLS++ }
engine.clearLog()
engine.log(`Roll: ${TOTAL_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) {
SE.sound_loop(8)
target.pull("min")
bet.pull("min")
}
}
};
async function normal_betting() {
const { multiplier } = await analyzeBet()
new Roll(100, 1.01, 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 (ex.testing.simulation) ex.testing.simulation_balance += 0.01
PROFIT += 0.01
} else {
if (ex.testing.simulation) ex.testing.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 (ex.testing.simulation) ex.testing.simulation_balance += 0.01
PROFIT += 0.01
} else {
if (ex.testing.simulation) ex.testing.simulation_balance -= 1
PROFIT -= 1
}
}
nonce++
new Roll(ex.fast_betting.wager, ex.fast_betting.chase, result.multiplier)
await updateStreaks(result.multiplier);
await updateLog();
});
queue = [];
};
function calcTarget(skips_used_by_median, results) {
let pLen = results.length
if (pLen < skips_used_by_median) {
if (MEDIAN_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( r.length / 2)
if (MEDIAN_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 = median_loses.length || 0
let baseBet = betSize(engine.balance * (MEDIAN_BET_BALANCE / (200 - lossCount)));
engine.log(`base Bet is ${baseBet / 100}`)
let vectorApex = calcTarget(median_skips, median_results);
if (!lossCount) {
if (MEDIAN_DEBUG) { engine.log(`[DEBUG] Base bet ${baseBet / 100}, no losses.`); }
return baseBet;
}
let losses = (median_loses.reduce((a, b) => a + b) * 100);
let nextBet = betSize((baseBet + (losses / ((vectorApex * 100) - 1))));
if (MEDIAN_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;
median_nextBet = calcBet(), vectorApex = calcTarget(game_strategy.Settings.modifications.median.skips_used_by_median, median_results)
if (median_results.length < game_strategy.Settings.modifications.median.skips_used_by_median) {
if (MEDIAN_DEBUG) engine.log(`[DEBUG] gathered initial data (${median_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 ${median_nextBet / 100} bits @ ${vectorApex * 100}x next.`)
var { multiplier } = await engine.bet(betSize(median_nextBet), vectorApex * 100);
log_history.push(multiplier)
rolls_history.push(multiplier)
SE.sound_loop(6)
}
median_results.push(multiplier);
if (multiplier >= vectorApex * 100) {
median_loses = []
let profit = median_nextBet * vectorApex - median_nextBet;
engine.log(`[WIN] Won at ${multiplier}x, Cashed at ${vectorApex * 100}x for ${profit / 100} bits profit.`);
} else {
median_loses.push(median_nextBet / 100)
let loss = median_loses.reduce((a, b) => a + b);
engine.log(`[LOSS] Bust at ${multiplier}x, Current losses at ${loss} bits`);
}
engine.log(`Loses: ${median_loses.length}`)
}
};
class SoundEngine{
constructor() {
this.id = -1
this.url = ``
this.host = `https://raw.githubusercontent.com/ruzli/misc/master/`
this.format = `.wav`
this.name = ``
this.library = []
this.sound_track = [ `cl_hihat`, `claves`, `conga1`, `cowbell`, `hi_conga`, `hightom`, `rimshot`, `snare`, `tom1`, `sc` ]
this.muted = false
this.default_sound_betting = 8
this.save(`https://freesound.org/data/previews/274/274178_5123851-lq.mp3`)
this.save(`https://freesound.org/data/previews/411/411639_5121236-lq.mp3`)
//if (config_hided.play_intro ) this.play_raw(this.song(1))
}
get song_library(){
return this.library
}
/* Playing sound loop by number or by name from sound track listed below. */
async sound_loop(sound_number = default_sound_betting(), name = undefined){
await this.play(sound_number, name)
}
async sound_beat(multiplier, beat_mode = false, beat_target = undefined) {
if (multiplier == undefined) {
console.log(`Something is wrong with sound engine.`)
await sleep(3000)
return
}
if (beat_mode) {
if (multiplier < 5) {
SoundEngine.prototype.sound_loop(8)
} else if (multiplier < 10) {
SoundEngine.prototype.sound_loop(1)
} else if (multiplier < 15) {
SoundEngine.prototype.sound_loop(2)
} else if (multiplier < 20) {
SoundEngine.prototype.sound_loop(5)
} else if (multiplier < 25) {
SoundEngine.prototype.sound_loop(4)
} else if (multiplier < 30) {
SoundEngine.prototype.sound_loop(6)
} else if (multiplier < 35) {
SoundEngine.prototype.sound_loop(7)
} else if (multiplier < 40) {
SoundEngine.prototype.sound_loop(0)
} else {
SoundEngine.prototype.sound_loop(3)
}
} else {
if (multiplier >= beat_target || beat_target != undefined) {
SoundEngine.prototype.sound_loop(8)
} else {
SoundEngine.prototype.sound_loop(3)
}
}
};
set default_sound_betting(default_sound_number){
this.default_sound = default_sound_number
}
link(){
if (this.name != ``){
return this.url + this.name + this.format
}
}
song(song_number){
return this.library[song_number]
}
save(url){
this.library.push(url)
}
async play(sound_number, name){
let sound_track = this.sound_track
let url = this.host
let format = this.format
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 {
console.log(`Sound ${sound_number} not found.`)
}
const audio = new Audio(full_string)
if (!this.muted) await audio.play()
return new Promise(resolve => audio.onended = resolve)
}
async play_raw(url){
const audio = new Audio(url)
if (!this.muted) await audio.play()
return new Promise(resolve => audio.onended = resolve)
}
};
var SE = new SoundEngine;
/* Check current site where sandbox is being launched:
Bustadice, Bustabit v2, Bustabit v1 */
const diceCheck = () => {
let site = ``
try { this.resetStatistics()
site = `Bustadice`} catch (e){}
try { engine.getState()
site = `Bustabit v2`} catch (e){}
try { engine.getEngine()
site = `Bustabit v1`} catch (e){}
if (site == ``) { console.log(`Site not defined`) }
console.log(`This is ${site}`);
return site
};
class Sandbox {
get luck(){
}
get median(){
}
get winning_rate(){
}
get random(){
}
};
class StrategyObject {
constructor(target, baseBet = 100, max_turns = 0, stw = 0, multiplier = null, return_to_basebet = true) {
this.target = target;
this.basebet = basebet;
this.max_turns = max_turns;
this.STW = stw;
this.multiplier = multiplier;
this.return_to_basebet = return_to_basebet;
/*this.Settings = {
bet: {
multiplier: multiplier,
bet: baseBet,
minimal: baseBet,
maximal: max_turns,
},
target: {},
modifications: {},
information: {},
};*/
};
/*
get longest_streak(){
}
get max_turns(){
}
get formula_multiplier(){
}
get max_bet_size(){
}*/
};
class Pattern {
/** Class which gives alot of advantages in pattern finding via rolls manipulation.
* 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++;
}
};
class Console {
/* Build console menu with groups */
main(){
console.clear()
console.warn(`You using v${ver} of Sandbox Script made by Ruzli#7111, if you have questions or suggestions, write me at ruzli999@gmail.com or if you want say thanks me for sandbox simply tip to Ruzli or donate to my team 1GUU7UZLAWUAA58bx9zuJiTM7eLGUoK6wi`)
this.menu()
this.state()
this.strategy()
}
menu(){
console.group(`Sandbox Script v${ver}`);
console.groupCollapsed(`Sandbox - Script Launch Configuration`)
this.print_script()
console.groupEnd();
console.groupCollapsed(`Sandbox - Available Launch Cases`)
this.write_cases()
console.groupEnd();
console.groupCollapsed(`Sandbox - Game Preferences`)
this.write_game_preferences()
console.groupEnd();
console.groupCollapsed(`Sandbox - Changelog`)
this.write_updates()
console.groupEnd();
console.groupCollapsed(`Sandbox - Documentation`)
console.log(`Join https://discord.gg/5R2YvY my discord server.`)
console.groupCollapsed(`Sandbox - Addons`)
console.log(`Visit https://baecoin.selly.store/ for recent free and not only extentions.`)
console.groupEnd();
console.groupCollapsed(`Sandbox - GUI [How to/What for]`)
console.table(cases);
console.groupEnd()
console.groupCollapsed(`Sandbox - Code [Tutorials]`)
console.log(`Visit https://github.com/ruzli/script_cases for extentions and future tactics you will able to download.`)
console.groupEnd()
console.groupCollapsed(`Sandbox - Credits`)
this.credits()
console.groupEnd()
console.groupEnd()
}
state(){
if (config.sb_simulation_mode.value || config.sb_emulate_rolls.value) {
console.log('Running - Simulation');
console.group('Status');
console.log(`[S]Balance: ${(ex.testing.simulation_balance / 100).toFixed(2)} bits`);
} else {
console.log('%cRunning - Live','color:Purple');
console.group('Status [Live]');
console.log(`Balance: ${engine.balance / 100} bits`);
}
console.log(`Profit: ${(PROFIT / 100).toFixed(2)} bits`);
console.groupEnd();
console.group('Features');
console.log(`Last run Strategy ${last_strategy}x`);
console.log(`At streak ${STREAK_ROLL}`);
console.log(`Median: ${getMedian()}x`);
console.log(`min Profit: ${minProfit / 100} bits`)
console.log(`max Profit: ${maxProfit / 100} bits`)
console.groupCollapsed(`Rolls: ${TOTAL_ROLLS}`)
console.table(rolls_history)
console.groupEnd();
}
strategy(amount_to_show = 30){
if (game_array.length <= amount_to_show || amount_to_show == -1) {
console.group(`Strategies: ${game_array.length}`);
for (let i = 0; i < game_array.length; i++) {
console.groupCollapsed(`Strategy: ${game_array[ i ].target.toFixed(2)}x - [${game_array[ i ].enabled}]`)
console.log(`STW: ${game_array[ i ].LS} / ${Math.round(game_array[ i ].STW)}`);
console.log(`Base bet: ${Math.round(game_array[ i ].basebet_default)} sats`);
console.log(`Current bet: ${Math.round(game_array[ i ].bet)} sats`);
console.log(`Multiplier: ${game_array[ i ].Settings.bet.multiplier.toFixed(5)}`);
console.log(`Run times: ${game_array[ i ].RUNS}`);
console.log(`Could catch: ${game_array[ i ].MISSED}`);
console.log(`Longest streak: ${game_array[ i ].MAX_STREAK}`);
console.log(`Profit: ${game_array[ i ].PROFIT.toFixed(2) / 100} bits`);
console.log(`Target: ${game_array[ i ].target.toFixed(2)}x`);
console.log(`Last streak: ${game_array[ i ].STREAK_ROLL}`);
console.log(`Current bet: ${Math.round(game_array[ i ].bet / 100)} bits`);
console.groupEnd();
}
}
console.group(`Active Strategy: ${game_array[ active_playing ].target.toFixed(2)}x`)
console.log(`STW: ${game_array[ active_playing ].LS} / ${Math.round(game_array[ active_playing ].STW)}`);
console.log(`Base bet: ${Math.round(game_array[ active_playing ].basebet_default)} sats`);
console.log(`Current bet: ${Math.round(game_array[ active_playing ].bet)} sats`);
console.log(`Multiplier: ${game_array[ active_playing ].Settings.bet.multiplier.toFixed(5)}`);
console.log(`Run times: ${game_array[ active_playing ].RUNS}`);
console.log(`Could catch: ${game_array[ active_playing ].MISSED}`);
console.log(`Longest streak: ${game_array[ active_playing ].MAX_STREAK}`);
console.log(`Profit: ${game_array[ active_playing ].PROFIT.toFixed(2) / 100} bits`);
console.log(`Target: ${game_array[ active_playing ].target.toFixed(2)}x`);
console.log(`Last streak: ${game_array[ active_playing ].STREAK_ROLL}`);
console.log(`Current bet: ${Math.round(game_array[ active_playing ].bet / 100)} bits`);
console.groupEnd();
console.groupEnd();
console.groupEnd();
}
credits(){
//console.log('%c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
console.log('%cSandbox Script made by Ruzli#7111','color:Purple')
console.log(`Version of Sandbox v${ver}.\n\n`)
//v${ver}.\n\n'
//console.log('%c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
}
write_game_preferences(){
let output = ``;
Object.defineProperty(ex, "fast_betting", {enumerable:false});
Object.defineProperty(ex, "session_game", {enumerable:false});
Object.defineProperty(ex, "hard_style", {enumerable:false});
Object.defineProperty(ex, "stats_logging", {enumerable:false});
Object.defineProperty(ex, "globals", {enumerable:false});
Object.defineProperty(ex, "seed", {enumerable:false});
Object.defineProperty(ex, "testing", {enumerable:false});
output += `\n----------------------------------------\n Ex - Game Properties \n----------------------------------------\n`
for (let i = 0; i < Object.getOwnPropertyNames(ex).length; i++){
if (Object.keys(ex)[i] != undefined)
output += `${Object.getOwnPropertyNames(ex)[i]}: ${Object.values(ex)[i]};\n`
}
output += `\n----------------------------------------\n Ex - Globals \n----------------------------------------\n`
for (let i = 0; i < Object.getOwnPropertyNames(ex.globals).length; i++){
if (Object.keys(ex.globals)[i] != undefined)
output += `${Object.getOwnPropertyNames(ex.globals)[i]}: ${Object.values(ex.globals)[i]};\n`
}
output += `\n----------------------------------------\n Ex - Seed \n----------------------------------------\n`
for (let i = 0; i < Object.getOwnPropertyNames(ex.seed).length; i++){
if (Object.keys(ex.seed)[i] != undefined)
output += `${Object.getOwnPropertyNames(ex.seed)[i]}: ${Object.values(ex.seed)[i]};\n`
}
console.log(`${output}\n`)
}
write_updates(){
let output = ``;
output += ` Sandbox changelog:\n\n`
output += `- Version 2.0 -\n\n`
output += `* New logging system.\n`
output += `* Easy loading and saving system.\n`
output += `* Prepare for even more easy reading console variables.\n`
output += `\n - Version 2.1 -\n\n`
output += `* Game preferences also is shown in console group.\n`
output += `* Added checkbox as last GUI element for save script in text file.\n`
output += `\n - Version 2.11 -\n\n`
output += `* Added emulated rolls, to run game checkbox GUI.\n`
output += `\n - Version 2.12 -\n\n`
output += `* Added full logging to each playing strategy in console.\n`
output += `* Added rolls history available in console.\n`
output += `\n - Version 2.13 -\n\n`
output += `* Many bug fixes and stability improvements.\n`
output += `* Added case under number 11 for nyan hunting.\n`
output += `* Added case under numbers 12 for low balances(-1500, +2000 bits) and non-martingale tactics.\n`
output += `* Added case under numbers 13 for normal balances(-10k +10k bits) and non-martingale tactics(5x, 10x, 15x, 20x).\n`
output += `\n - Version 2.14 -\n\n`
output += `* Added case under number 1000 for safe run(998 targets play, set in GUI RF, RM, RB).\n`
output += `* Added case under number 14 for insane fast and risky profit(10x, 20x).\n`
output += `\n - Version 2.15 -\n\n`
output += `* Added case under number 20 for safe run and low balance(3000 bits, 4x, 5x, ... 10x).\n\n`
console.log(output);
}
write_cases(){
let output = ``
output += `To use just write in launch configuration case number strategy you liked with ID.\n`
output += `Total installed cases: ${cases.length}\n\n`
console.log(output)
console.table(cases);
}
async print_script(){
let output = ``
output += `ex.analyze_streaks = ${ex.analyze_streaks};\n\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+= `ex.testing.simulation = ${ex.testing.simulation};\n`
//output+= `ex.testing.simulation_balance = ${ex.testing.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 += `new Strategy(${gs.target}, ${config.sb_base_bet.value}, ${gs.MAX_BET_TURNS}, ${gs.STW}, ${gs.Settings.bet.multiplier.toFixed(7)}, ${gs.Settings.bet.return_at.RETURN_BASE}));\n`
}
output += `\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 = ${config.sb_base_bet.value};\n`
output += `game_array[ ${i} ].basebet_default = ${config.sb_base_bet.value};\n`
output += `game_array[ ${i} ].bet = ${config.sb_base_bet.value};\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} ].enabled = ${gs.enabled};\n\n`
/* Object Bet Attributes || bet: multiplier, base, mode(mul/add), minimal, maximal, return_at(RETURN_BASE, on_win, on_lose) */
let temp_mul = gs.Settings.bet.multiplier
if (temp_mul == 0) temp_mul = get_formula_multiplier(gs.Settings.target)
output += `game_array[ ${i} ].Settings.bet.multiplier = ${gs.Settings.bet.multiplier.toFixed(7)};\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.toFixed(2)};\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\n`
/* Object Trigger Attribute */
output += `game_array[ ${i} ].ACTION = async function () { await strategy_play(this) };\n`
output += `game_array[ ${i} ].PRE_ROLL = async function () { };\n\n`
/* Object Modifications - Chain Chase */
if (gs.Settings.modifications.chain_chase.enabled) {
output += `game_array[ ${i} ].Settings.modifications.chain_chase.enabled = ${gs.Settings.modifications.chain_chase.enabled};\n`
output += `game_array[ ${i} ].Settings.modifications.chain_chase.queue_base = ${gs.Settings.modifications.chain_chase.queue_base};\n\n`
}
/* Object Modifications - Median */
if (gs.Settings.modifications.median.enabled) {
output += `ex.analyze_streaks = true;\n`
output += `game_array[ ${i} ].ACTION = await median_loop(game_array[ ${i} ]);\n`
output += `game_array[ ${i} ].Settings.modifications.median.enabled = ${gs.Settings.modifications.median.enabled};\n`
output += `game_array[ ${i} ].Settings.modifications.median.min_cut = ${gs.Settings.modifications.median.min_cut};\n`
output += `game_array[ ${i} ].Settings.modifications.median.max_cut = ${gs.Settings.modifications.median.max_cut};\n`
output += `game_array[ ${i} ].Settings.modifications.median.bet_balance = ${gs.Settings.modifications.median.bet_balance};\n`
output += `game_array[ ${i} ].Settings.modifications.median.skips_used_by_median = ${gs.Settings.modifications.median.skips_used_by_median};\n\n`
}
/* Object Modifications - Pullee */
if (gs.Settings.modifications.pullee.enabled) {
output += `ex.analyze_streaks = false;\n`
output += `let bet_base = config.sb_bets_minimal.value;\n`
output += `let bet_max = config.sb_bets_minimal.value;\n`
output += `let bet_power = config.cb_bets_modes.options.mul.value;\n\n`
output += `let target_base = config.sb_target_minimal.value;\n`
output += `let target_max = config.sb_target_maximal.value;\n`
output += `let target_power = config.sb_pullee.value;\n\n`
output += `let target_pull = CreatePullee(target_base, target_base, target_max, target_power)();\n`
output += `let bet_pull = CreatePullee(bet_base, bet_base, bet_max, bet_power)();\n\n`
output += `game_array[ ${i} ].ACTION = await strategy_pullee(bet_pull, target_pull);\n`
output += `game_array[ ${i} ].Settings.modifications.pullee.enabled = ${gs.Settings.modifications.pullee.enabled};\n`
output += `game_array[ ${i} ].Settings.modifications.pullee.power = ${gs.Settings.modifications.pullee.power};\n`
};
};
if (config.PASTE_CASE.value == `Paste raw text [see F12]`) {
console.log(output)
if (config.sb_save_script.value && !downloaded) {
downloaded = true
downloadString(output, "txt", "ScriptCase.txt")
await sleep(1500)
}
} else {
console.log(config.PASTE_CASE.value)
}
};
};
/* Main loop is starting from here */
const main = async () => {
// CHECK ON WHAT SITE SANDBOX WAS LAUNCHED
if (diceCheck() != `Bustadice`){
engine.stop()
}
// PREINITIALIZATION BEFORE GAME STARTING AREA
await preload_setup_script();
while (true) {
if (nonce >= change_seed_next) { // && ex.allow_seed_rese
// CHECK IF GENERATE SEED IS REQUIRED
await generateSeed();
nonce = 0
updateLog()
};
// READING ROLLS FOR LOGIC AND SAFETY RUNS
if (ex.analyze_streaks || game_array.length == 0) {
await gather_information(); // Analyze rolls, with using STW feature(streak to wait).
};
// CYCLE OF [STRATEGIES] PLAYING STARTED
for (let igo = 0; igo < game_array.length; igo++) {
// RESET AND BREAK CHAIN OF TACTICS RUN IF SET IN CONFIG
if (ex.reset_to_first_on_hit_win && RUNNING == true) {igo = 0; RUNNING = false; break};
// CHECK IF CURRENT STRATEGY IS ENABLED
if (game_array[ igo ].enabled) {
// EXECUTE STRATEGY ACTION TO PLAY
active_playing = igo
await game_array[ igo ].ACTION();
};
}; // CYCLE OF STRATEGIES PLAYING ENDED
};
// [GAME ENDING AREA]
};
/* Prevent script from lost connection to server */
while (true) {
// WATCH FOR ERROR IN MAIN LOOP
try {await main()} // MAIN LOOP
catch (error) {
// ERROR EVENTS TO HANDLE
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");
//downloadRolls();
await this.stop();
} else {
//await this.log(error.message);
throw error;
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment