Created
October 18, 2019 16:38
-
-
Save ruzli/fc0eeccb72c44831e5c20573b4f2124e to your computer and use it in GitHub Desktop.
Find MaxStreaks for different payouts at same time
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
var game_array = [], game_stw = [], game_ls = []; | |
var rolls = 0; | |
var engine = this; | |
var auto_betting = true | |
const playing_area = 3; | |
const diffculty_game = 12; | |
class Target { | |
constructor (target) { | |
this.target = target; | |
console.log(`${this.target}x created`); | |
}; | |
addPayout(payout, streak) { | |
game_array.push(payout); | |
if (streak == undefined) { | |
game_stw.push(calculate_stw(payout)); | |
} else { | |
game_stw.push(streak); | |
} | |
game_ls.push(0); | |
}; | |
cleanPayouts() { | |
game_array = []; | |
game_stw = []; | |
game_ls = []; | |
}; | |
resetLS() { | |
for (let i = 0; i < game_array.length; i++) { | |
game_ls[ i ] = 0; | |
}; | |
}; | |
}; | |
fill_stw(); | |
/**** Payout | STW ***/ | |
new Target().addPayout(4); | |
new Target().addPayout(5); | |
new Target().addPayout(10); | |
new Target().addPayout(20); | |
new Target().addPayout(30); | |
new Target().addPayout(40); | |
new Target().addPayout(60); | |
new Target().addPayout(100); | |
new Target().addPayout(200); | |
new Target().addPayout(300); | |
new Target().addPayout(1000); | |
/*********************/ | |
function updateStreaks(multiplier) { | |
let output = ``; | |
for (let i = 0; i < game_array.length; i++) { | |
if (multiplier < game_array[ i ]) { | |
game_ls[ i ]++; | |
} else if (multiplier > game_array[ i ]) { | |
game_ls[ i ] = 0; | |
} | |
output += ` | ${game_array[ i ]}x: ${game_ls[ i ]}/${Math.round(game_stw[ i ])}`; | |
} | |
engine.clearLog() | |
engine.log(output + ` |`); | |
} | |
function calculate_stw(target) { return (target * diffculty_game) / playing_area; }; | |
function fill_stw() { | |
if (game_stw.length >= game_array.length) return; | |
for (let i = 0; i < game_array.length; i++) { | |
game_stw.push(calculate_stw(game_array[ i ])); | |
game_ls.push(0); | |
}; | |
}; | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)) | |
}; | |
function roundBit(bet) { | |
return Math.max(100, Math.round(bet / 100) * 100); | |
}; | |
var start_play = false; | |
var currentPayout; | |
var currentBet = 100; | |
var attempt = 0; | |
while (true) { | |
rolls++; | |
if (start_play){ | |
var { multiplier } = await this.bet(roundBit(currentBet), currentPayout); | |
await sleep(250) | |
if (multiplier < currentPayout){ | |
attempt++; | |
if (attempt == Math.round(currentPayout)){ | |
attempt = 0; | |
currentBet *= 2; | |
} | |
} else { | |
currentBet = 100; | |
start_play = false; | |
} | |
} else { | |
var { multiplier } = await this.bet(100, 1.01); | |
updateStreaks(multiplier); | |
} | |
for (let i = 0; i < game_array.length; i++) { | |
if (game_ls[ i ] >= game_stw[ i ]) { | |
engine.log(`${game_array[ i ]}x catched! Roll ${rolls}, Streak rows ${game_ls[ i ]}/${Math.round(game_stw[ i ])}`); | |
if (auto_betting){ | |
start_play = true; | |
currentPayout = game_array[ i ]; | |
currentBet = 100; | |
attempt = 0; | |
game_ls[ i ] = 0; | |
} else { | |
await engine.stop(); | |
} | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment