Skip to content

Instantly share code, notes, and snippets.

@ruzli
Last active August 23, 2018 00:01
Show Gist options
  • Save ruzli/a7849f9f3bfc91a364ca93a892690ab0 to your computer and use it in GitHub Desktop.
Save ruzli/a7849f9f3bfc91a364ca93a892690ab0 to your computer and use it in GitHub Desktop.
Skipping until streaks N times for 1.35x
const baseBet = 300 /* In satoshi, which means it will place 2 bits */
const target = 1.35
const streakSeek = 1 /* How much streaks in a row until starting to place bets */
const multiplierBet = 3 /* Multiply base bet if not regular bet was loss */
const stopLoss = 0 /* Stop script if balance will go under this value */
const regularBet = 100
const regularTarget = 1.35
const placeRegularNotSkip = true /* Place bets or skips */
const engine = this
let _baseBet = baseBet
let _bad_multipliers = 0
while (true)
{
if(stopLoss > this.balance){
this.log("stopLoss was activated and stopped script")
await this.stop()
}
if (placeRegularNotSkip != true){
const{ multiplier } = await this.skip()
}else{
var{ multiplier } = await this.bet(regularBet, regularTarget)
}
if(multiplier < target){
_bad_multipliers++
this.log(`Bad multipliers ${multiplier}`)
} else {
_bad_multipliers = 0
}
if (_bad_multipliers >= streakSeek){
this.log(`Betting ${_baseBet}`)
const{ multiplier } = await this.bet(_baseBet, target)
_bad_multipliers = 0
if (multiplier < target){ // loss
gong()
await generateSeed()
_baseBet = _baseBet * multiplierBet
} else { // win
collectSound()
_baseBet = baseBet
}
_bad_multipliers = 0
}
}
function gong(){
const audio = new Audio("https://bustadice.com/5bb187b7ef764e76fb519939f77288c1.mp3")
audio.play()
return new Promise(resolve => audio.onended = resolve)
}
function collectSound(){
const audio = new Audio ("http://kz-developer.ru/sounds/chipsHandle6.wav")
audio.play()
return new Promise(resolve => audio.onended = resolve)
}
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 = ['Alegra ','Bravon ','Charlik ','Delago ','Zecho ','Forextromb ','Hotelka ','Gnomus ','Addicted ','Aurelia ','Zigalo ','Wiverma ',
'Mariner ','Octoberfest ','Nascar ','Papaja ','Alberts ','Gomus ','Fierra ','GTO ','Unicorn ','Vicantus ','Siski ','Xavier ','Poiuplet ','Antutulika ']
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