Last active
April 18, 2019 03:18
-
-
Save ruzli/cfec980871de6c21d21ad2807baaacfc to your computer and use it in GitHub Desktop.
Periodic AntiScript Counterparty
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
/* AntiScript v1.06 Example uses configurables to obtain diffirent strategies: | |
baseTarget = 1.35, maximumBet = 500, multiplierBet = 4; that will turn script to safe enough | |
baseTarget = 1.35, maximumBet = 100, multiplierBet = 1.02; slowly increases and stays until lose bet | |
baseTarget = 15, maximumBet = 110, multiplierBet = 1.02; big profits, little risk */ | |
/* Common */ | |
const baseBet = 1 /* In bits */ | |
const baseTarget = 1.35 | |
/* Periods */ | |
const PeriodBet = 1 | |
const PeriodTarget = 1.35 | |
const basePrewait = 10 /* Periods rolls before attempts to start */ | |
const baseAfterwait = 1 /* How much rolls will play without green, before going to prewait */ | |
const baseAfterStartPlay = 3 /* How much baseTarget win need to be triggered times by period in prewait */ | |
/* Limits */ | |
const skipAfterStreak = 88 | |
const minimalToRunScript = 0 | |
const maximumBet = 1000 | |
const maximumProfit = 20000 | |
/* Modificators */ | |
const multiplierBet = 7 | |
/* Seed Management */ | |
const changeSeed = true | |
const changeSeedEveryX = 5 | |
/* Settings */ | |
const enable_game_sounds = false | |
const sleepTime = 0 | |
const winsStreak = 3 /* SleepTime slow down after wins streak */ | |
let engine = this | |
let prewait = basePrewait | |
let AfterStartPlay = baseAfterStartPlay | |
let afterwait = 0 | |
let bet = baseBet | |
let gameStarted = false | |
let losses = 1 | |
let rollSeed = 0 | |
let lost = 0 | |
let wins = 0 | |
var multiplier | |
var since = new Date() | |
var d = new Date() | |
var formedBet | |
var formedTarget | |
engine.log(`Starting Script at ${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}`) | |
engine.log(`Starting Periodic AntiScript v1.06 by Ruzli`) | |
while(true){ | |
rollSeed++ | |
if(changeSeed == true && changeSeedEveryX > 0){ | |
if (rollSeed > changeSeedEveryX) { | |
setNewSeed() | |
rollSeed = 0 | |
engine.log(`Seed was reset!`) | |
} | |
} | |
if (engine.balance / 100 >= maximumProfit){await engine.stop()} | |
if (gameStarted == true) {afterwait++}else{prewait--} | |
if (gameStarted == true) {formedTarget = baseTarget}else{formedTarget = PeriodTarget} | |
if (prewait <= 0) {resetPrewait()} | |
if (toBits(this.balance) <= minimalToRunScript) { | |
await stopGame() | |
} | |
if (bet * losses >= maximumBet) {losses = 1} | |
if (AfterStartPlay <= 0) {gamePeriod(true)} | |
if (afterwait >= baseAfterwait) {gamePeriod(false)} | |
if (formedTarget == null){formedTarget = 1.01} | |
if (gameStarted == true) { | |
formedBet = toSatoshi(toBits(Math.floor(toSatoshi(bet))) * Math.floor(toSatoshi(toBits(losses)))) | |
}else{ | |
formedBet = toSatoshi(PeriodBet) | |
} | |
if (sleepTime != 0){ | |
if (lost > 0){ | |
await sleep(sleepTime * lost) | |
}else{ | |
await sleep(sleepTime) | |
} | |
if (wins > winsStreak){ | |
await sleep(sleepTime * winsStreak) | |
} | |
} | |
if (lost >= skipAfterStreak ){await this.skip() | |
lost = 0 | |
} | |
else{ | |
var{ multiplier }= await this.bet(formedBet, formedTarget) /* BET */ | |
engine.log(`Starting in: ${AfterStartPlay}, Prewait: ${prewait}, Afterwait: ${afterwait}(${baseAfterwait})`) | |
} | |
if (multiplier > baseTarget){ | |
formedTarget = PeriodTarget | |
if (gameStarted == true){ | |
formedTarget = baseTarget | |
} | |
} | |
if (multiplier < baseTarget){ /* [LOSS] */ | |
lost++ | |
wins = 0 | |
if (baseTarget >10){gong()}else{collectSound()} /* Sounds Swap */ | |
if (baseBet * losses >= maximumBet){ | |
/* Nothing do at the moment for now. */ | |
}else{ | |
if (gameStarted == true){ | |
losses = losses * multiplierBet + Math.floor(multiplierBet / 0.7) | |
} | |
} | |
}else{ /* [WIN] */ | |
lost = 0 | |
wins++ | |
if (baseTarget > 10){collectSound()}else{gong()} | |
afterwait = 0 | |
AfterStartPlay-- | |
if (gameStarted == true){ | |
losses = Math.round(losses / multiplierBet) | |
if (losses <= baseBet) {losses = 1} | |
} | |
} | |
} | |
function gamePeriod(state){ | |
gameStarted = state | |
prewait = basePrewait | |
afterwait = 0 | |
if(AfterStartPlay - 1 <= 1){ | |
AfterStartPlay = baseAfterStartPlay | |
} else { | |
AfterStartPlay = baseAfterStartPlay | |
} | |
} | |
function resetPrewait(){ | |
prewait = basePrewait | |
AfterStartPlay = baseAfterStartPlay | |
} | |
function gong(){ | |
const audio = new Audio("https://bustadice.com/5bb187b7ef764e76fb519939f77288c1.mp3") | |
if (enable_game_sounds != false){audio.play()} | |
return new Promise(resolve => audio.onended = resolve) | |
} | |
function collectSound(){ | |
let pathStr = "http://kz-developer.ru/sounds/chipsHandle" + getRandomInt(6,7) + ".wav" | |
const audio = new Audio (pathStr) | |
if (enable_game_sounds != false){audio.play()} | |
return new Promise(resolve => audio.onended = resolve) | |
} | |
function setNewSeed() { | |
const { server_seed_hash } = engine.newSeedPair() | |
engine.log("The new server seed has the hash: ", server_seed_hash) | |
// set the client seed | |
const clientSeed = randomSeed() | |
} | |
function randomSeed() { | |
const words = ['Alpha ','Bra3qtwvo ','Charlie ','Delta ','Echo ', | |
'Foxtrot ','Go3tewlf ','Hotel ','Indda ','Juliet ', | |
'Kiqagalo ','L24rqwima ','Mirhe ','November ','Oscar ', | |
'Papayww ','Quebec ','Romeo ','Sierra ','Tango ', | |
'Uniform ','Victor ','Whiskey ','X-ray ','pooper ','Zulu '] | |
return words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] | |
} | |
function getRandomInt(min, max){ | |
return Math.floor(Math.random() * (max - min)) + min; | |
} | |
function toBits(satoshi){ | |
return satoshi / 100 | |
} | |
function toSatoshi(bits){ | |
return bits * 100 | |
} | |
function elapsedtime() { | |
let sincePast = new Date() | |
let sincePastDate = new Date() | |
engine.log(`Since started script: ${sincePastDate.getHours()}:${sincePastDate.getMinutes()}:${sincePastDate.getSeconds()}`) | |
} | |
async function stopGame(){ | |
engine.log(`Minimal balance is reached, stopping script`) | |
elapsedtime() | |
await engine.stop() | |
} | |
async function sleep(ms){return new Promise(resolve => setTimeout(resolve, ms))} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment