Skip to content

Instantly share code, notes, and snippets.

@jdleo
Last active November 11, 2017 22:54
Show Gist options
  • Select an option

  • Save jdleo/388fb972920b71d7410f7bd488743d9d to your computer and use it in GitHub Desktop.

Select an option

Save jdleo/388fb972920b71d7410f7bd488743d9d to your computer and use it in GitHub Desktop.
const baseBet = 200 //base bet (in sats)
const baseTarget = 1.20 //base target
const maxRolls = 200 //max rolls script will do
const infiniteRolls = true //ignores max rolls
const changeSeedAfterY = 200 //change seed after this many rolls
let target = baseTarget //initialize target as base
let betCount = 0 //bet count if using max rolls
this.log(`Give me all the wins!...`)
while (betCount < maxRolls || infiniteRolls) {
//make bet, wait for result
const {multiplier} = await this.bet(baseBet, target)
if (multiplier < target) {
//loss
this.log(`Loss. :/`)
//increase target by baseTarget
target = target + baseTarget
} else {
//win
//set target back to baseTarget
target = baseTarget
this.log(`Win.`)
}
betCount++
if (betCount % changeSeedAfterY == 0 && betCount != 0) {
const { server_seed_hash } = await this.newSeedPair()
await this.log("The new server seed has the hash: ", server_seed_hash)
// set the client seed
const clientSeed = randomSeed()
await this.setClientSeed(clientSeed)
await this.log("The client seed was set to: ", clientSeed)
}
}
function randomSeed() {
const words = ['Alpha ','Bravo ','Charlie ','Delta ','Echo ',
'Foxtrot ','Golf ','Hotel ','India ','Juliet ',
'Kilo ','Lima ','Mike ','November ','Oscar ',
'Papa ','Quebec ','Romeo ','Sierra ','Tango ',
'Uniform ','Victor ','Whiskey ','X-ray ','Yankee ','Zulu ']
return words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment