Skip to content

Instantly share code, notes, and snippets.

@dsetzer
Last active May 7, 2020 17:30
Show Gist options
  • Select an option

  • Save dsetzer/644cf28ef1f214f1a07fd46a2ca2970d to your computer and use it in GitHub Desktop.

Select an option

Save dsetzer/644cf28ef1f214f1a07fd46a2ca2970d to your computer and use it in GitHub Desktop.
Proof of concept Oscar's Grind script fully functional universal compatibility playable on both bustabit & bustadice as well as simulators no modification needed.
var config = {
i: { type: 'noop', label: 'Oscar\'s Grind V2 Universal'},
a: { type: 'balance', label: 'Unit Size', value: 1000 },
c: { type: 'number', label: 'Bet Speed', value: 100 }
};
Object.entries(config).forEach(c=>window[c[0]]=c[1].value);
var dice = (()=>{try{engine==true;return !1;}catch(e){return !0;}})();
var sleep = t => new Promise(r => setTimeout(r, t)), b=1.98, d=a, e=0;
var round = b => Math.max(100, Math.round(b / 100) * 100);
var next = r => {r<b?e-=d:(e+=d,e<a&&(d=e+d+a>a?a-e:d+a),e>=a&&(e=0,d=a))};
if (dice) {
this.stop = () => {};
(async () => { for(;;){
await this.bet(round(d), b).then(r=>next(r.multiplier));
await sleep(c);
}})();
} else {
engine.on('GAME_STARTING', ()=>{
engine.bet(round(d), b);
});
engine.on('GAME_ENDED', ()=>{
let r = engine.history.first(); next(r.bust);
});
}
/* Copyright (c) 2019 Daniel Setzer. All rights reserved. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment