Created
August 14, 2018 12:08
-
-
Save ruzli/85d11b6b49c7625bfdb574b941f56b88 to your computer and use it in GitHub Desktop.
Playing on balance based percent bets
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
const baseBet = 1 // how many satoshis to bet initially | |
const target = 2 // target multiplier | |
const TargetProfit = 30000 | |
const dontLoseThan = 200 // Stopper | |
let ubalance = this.balance | |
this.log(ubalance) | |
const engine = this | |
//var betBits = parseInt(Math.floor(baseBet)); | |
this.log(`Starting martingale with a base bet of ${baseBet} satoshis.`) | |
while (true) { | |
checkConditions(this.balance) | |
let ass = this.balance/100 | |
let asb = Math.floor(ass / 100 * 1) * 100 | |
this.log(asb) | |
const { multiplier } = await this.bet(asb, target) | |
if (multiplier < target) { /* [LOSS] */ | |
collectSound() | |
} else { /* [WINS] */ | |
gong() | |
} | |
} | |
function calculatePercentBet(balance, percent){ | |
let b = (ubalance * percent) | |
engine.log(b) | |
return b | |
} | |
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 = ['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())]} | |
async function stopGame(){ | |
await engine.stop() | |
} | |
function checkConditions(balance){ | |
if(balance / 100 >= TargetProfit){ | |
engine.log(`You reached target profit of ${TargetProfit}`) | |
stopGame() | |
} | |
if(balance / 100 <= dontLoseThan){ | |
engine.log(`Your balance limit of ${dontLoseThan}, was reached. Stopping script`) | |
stopGame() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment