Skip to content

Instantly share code, notes, and snippets.

@dsetzer
Last active September 28, 2019 07:10
Show Gist options
  • Save dsetzer/5e433bd2931905d2c05b8bab91c89e3b to your computer and use it in GitHub Desktop.
Save dsetzer/5e433bd2931905d2c05b8bab91c89e3b to your computer and use it in GitHub Desktop.
A versatile micro script framework for bustadice using simple dynamic preset system.
// ------------------------ Preset Format ------------------------
var settings = [
100, // Base Bet
2.00, // Payout
(w)=>{ // onWin Callback
w.b = w.b / 2;
w.p = w.p;
},
(l)=>{ // onLose Callback
l.b = l.b * 2;
l.p = l.p;
},
5e3, // Bet Speed
];
// ------------------------ Example Presets ------------------------
// (All of these use 1 bit base bet and have a 5 second delay between bets, they're fairly safe to try
// Standard Martingale - Multiplies bet by 2 on loss, returns to 1 bit base bet on win.
var settings = [100, 2.00, (w)=>{ w.b = 100 }, (l)=>{ l.b *= 2 }, 5e3];
// Double-up/Double-down Martingale - Multiplies bet by 2 on loss and divides bet by 2 on win.
var settings = [100, 2.00, (w)=>{ w.b /= 2 }, (l)=>{ l.b *= 2 }, 5e3];
// Standard Payout Martingale - Increases payout by 1.0x on loss and bet amount never changes.
var settings = [100, 2.00, (w)=>{ w.p = 2 }, (l)=>{ l.p += 1 }, 5e3];
// Standard Labouchere - Bets first+last from list. Adds losses to end. Refills list when empty
var bets = [100, 100, 100, 100, 100], bl = bets.splice(), r = () => { if(bl.length < 1) bl = bets.splice()}
var settings = [100, 2.00, (w)=>{ w.b+=bl.shift(); r(); }, (l)=>{ l.b = bl.shift()+bl.pop(); r(); }, 5e3];
// More advanced examples/presets will be added soon..
// ------------------------ Core Script (with martingale preset to show usage) ------------------------
var settings = [100, 2.00, (w)=>{ w.b = 100 }, (l)=>{ l.b *= 2 }, 5e3]; // Preset is defined here (martingale)
await (async (a, b, c, d, e, f, g) => {
var h = async (i,w,x) => (
(w = (g ? {b: g.value, p: g.target} : {b:a, p:b}), x = (g ? (g.multiplier < b ? d(w) : c(w)) : null), f = w.b, b = w.p),
(g = await this.bet(Math.round(f / 1e2) * 1e2, b))
);
for (;;) await h().then(i => new Promise(r => setTimeout(r, e)));
})(...settings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment