-
-
Save BitChop/e1c83580d09a0ce3166f2638c0857e2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
baseBet: { value: 100, type: 'balance', label: 'base bet' }, | |
payout: { value: 2, type: 'multiplier' }, | |
stop: { value: 1e8, type: 'balance', label: 'stop if bet >' }, | |
loss: { | |
value: 'increase', type: 'radio', label: 'On Loss', | |
options: { | |
base: { type: 'noop', label: 'Return to base bet' }, | |
increase: { value: 2, type: 'multiplier', label: 'Increase bet by' }, | |
} | |
}, | |
win: { | |
value: 'base', type: 'radio', label: 'On Win', | |
options: { | |
base: { type: 'noop', label: 'Return to base bet' }, | |
increase: { value: 2, type: 'multiplier', label: 'Increase bet by' }, | |
} | |
}, | |
delay: { value: 100, type: 'number', label: 'Bet Speed' } | |
}; | |
this.log('Script is running..'); | |
var currentBet = config.baseBet.value; | |
for(;;){ | |
const result = await this.bet(roundBit(currentBet), config.payout.value); | |
if (result.multiplier >= result.target) { | |
if (config.win.value === 'base') { | |
currentBet = config.baseBet.value; | |
} else { | |
console.assert(config.win.value === 'increase'); | |
currentBet *= config.win.options.increase.value; | |
} | |
this.log('We won, so next bet will be', currentBet/100, 'bits') | |
} else { | |
// damn, looks like we lost :( | |
if (config.loss.value === 'base') { | |
currentBet = config.baseBet.value; | |
} else { | |
console.assert(config.loss.value === 'increase'); | |
currentBet *= config.loss.options.increase.value; | |
} | |
this.log('We lost, so next bet will be', currentBet/100, 'bits') | |
} | |
if (currentBet > config.stop.value) { | |
this.log('Was about to bet', currentBet, 'which triggers the stop'); | |
break; | |
} | |
await sleep(config.delay.value); | |
} | |
function roundBit(bet) { | |
return Math.round(bet / 100) * 100; | |
} | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment