Skip to content

Instantly share code, notes, and snippets.

@dsetzer
Last active November 17, 2021 22:35
Show Gist options
  • Save dsetzer/f3a886738b602b91c34c068324d6f289 to your computer and use it in GitHub Desktop.
Save dsetzer/f3a886738b602b91c34c068324d6f289 to your computer and use it in GitHub Desktop.
Oscar's Grind script for bustabit
var config = {
baseBet: { type: 'balance', label: 'Base Bet', value: 100 },
payout: { type: 'multiplier', label: 'Payout', value: 2 },
betIncr: { type: 'balance', label: 'Bet Incr', value: 100 },
reqProf: { type: 'balance', label: 'Profit', value: 100 }
};
Object.entries(config).forEach(c=>window[c[0]]=eval(c[1].value));
let currBet = baseBet, profit = 0;
engine.on('GAME_STARTING', () => {
engine.bet(roundBit(currBet), payout);
});
engine.on('GAME_ENDED', ()=>{
let lastGame = engine.history.first();
if(lastGame.wager){
if(lastGame.cashedAt){
profit += currBet * (payout - 1);
if(profit < reqProf){
if(profit + currBet + betIncr > reqProf){
currBet = reqProf - profit;
}else{
currBet += betIncr;
}
}
if(profit >= reqProf){
profit = 0, currBet = baseBet;
}
}else{
profit -= currBet;
}
}
log(profit, currBet);
});
function roundBit(bet){
return Math.max(100, Math.round(bet / 100) * 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment