const baseBet = 1 // how many bits to bet initially
const baseTarget = 2
const betMultiplier = 2 // what to multiply the bet size by when we lose a wager
let target =0 // target multiplier
const engine = this
let lossCount = 0
this.log(`Starting super martingale with a base bet of ${baseBet} satoshis.`)
while (true) {
// make the bet and wait for the result
const { multiplier } = await engine .bet(betSize(lossCount), target)
if (multiplier < target) { // loss
lossCount++
target = 2
engine .log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${betSize(lossCount)} satoshis.`)
await generateSeed()
} else { // win
lossCount = 0
target = 2
engine .log(`Won bet. Setting bet size to ${baseBet} satoshis.`)
}
}
function betSize(lossCount) {
let bet
if (lossCount < 11){
bet = baseBet
}
if (lossCount == 12){
bet = 1000
}
if (lossCount > 12){
bet = 1000 * 2
}
return bet * 100
}
async function generateSeed(){
const { server_seed_hash } = await engine.newSeedPair()
engine.log(`Server seed: ${server_seed_hash}`)
try {
const clientSeed = randomSeed()
await engine.setClientSeed(clientSeed)
engine.log(`Seed was set to: ${clientSeed}`)
}
catch(e){
engine.log(`Client seed already was reset and not used`)
}
}
function randomSeed(){
const words = ['Ze3foA1gAlpha ','Zefo3AG3B2r2a3qtwvo ','Zefo3AG313Charlie ','ZefoA22G3Delta ','Zef3o1GEcho ','ZefoA22G5oxtrot ','ZefoAG34G223tewlf ','Ze1o5A3GHotel ','ZefoA3dda ','Ze5f3Auliet ','ZefoAGK3agalo ','ZefoAG24rqwima ',
'Zef5oAG2Mrhe ','ZefoAG52ovember ','Ze67foGOscar ','Zefo3A45apayww ','Zef44A2Quebec ','ZefoAG433omeo ','ZefoA4GSierra ','ZefoA41GTngo ','ZefoA445GUniorm ','Ze37oGVictor ','ZefoA33W4hiskey ','ZefA3G4oXay ','Zef4Gpooper ','ZefoA3GZulu ']
return words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())]}