Skip to content

Instantly share code, notes, and snippets.

@jdleo
Created November 16, 2017 21:56
Show Gist options
  • Select an option

  • Save jdleo/2cb29a25bb0020225f2b6065f3ba6248 to your computer and use it in GitHub Desktop.

Select an option

Save jdleo/2cb29a25bb0020225f2b6065f3ba6248 to your computer and use it in GitHub Desktop.
const baseBet = 100
const target = 1.4
const maxLosses = 3
const multiplier = 4
let bet = baseBet
let lossStreak = 0
while (true) {
const {multiplier} = await this.skip(100,10)
if (multiplier < target) {
lossStreak++
} else {
lossStreak = 0
}
while (lossStreak >= maxLosses) {
this.log(`Red streak hit.. betting now`)
const {multiplier} = await this.bet(bet, target)
if (multiplier < target) {
this.log(`Miss.`)
lossStreak++
bet = bet * multiplier
} else {
this.log(`Hit. Back to skipping!`)
lossStreak = 0
bet = baseBet
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment