Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let accountNumber = 1;
- let autoCashOut = 10;
- let accountChase = 10;
- let variance = 0.50;
- let totalWagered = 0;
- let minWagered = 60;
- let bet = 1;
- let array = [];
- let test = true;
- let testVariable;
- let num = 0;
- let playerIndex = 0;
- let betSize = 0;
- engine.onUpdate = function(prevState) {
- if (engine.gameState !== prevState.gameState) {
- switch (engine.gameState) {
- case 'STARTING':
- onStarting();
- break;
- case 'IN_PROGRESS':
- onStarted();
- break;
- case 'ENDED':
- onEnded();
- break;
- }
- }
- };
- function onStarting() {
- if (engine.balance >= bet) {
- engine.placeBet(bet, autoCashOut).catch(console.error);
- }
- console.log("Our cashout will be at : " + autoCashOut);
- setTimeout(onStarted,5100);
- }
- function onStarted() {
- console.log('Game started!');
- array = [];
- for (num = 0; num < engine.players.length; num++) {
- testVariable = engine.players[num].autoCashOut;
- array.push(testVariable);
- }
- array.sort((a, b) => a - b);
- console.log(array);
- if (array[engine.players.length - accountNumber] <= accountChase) {
- autoCashOut = (array[engine.players.length - accountNumber]) + 0.01;
- accountChase = autoCashOut;
- } else {
- autoCashOut = accountChase + (Math.floor(((Math.random() * variance) * 100)) / 100);
- }
- }
- // Do some analyse from results and adjust your next strategy
- function onEnded() {
- for (playerIndex = 0; playerIndex < engine.players.length; playerIndex++) {
- betSize = engine.players[playerIndex].bet;
- totalWagered = totalWagered + betSize;
- }
- console.log("Total Wagered: " + totalWagered + " mETH");
- console.log('Game crashed at ' + engine.multiplier);
- if (totalWagered >= minWagered) {
- bet = 1;
- totalWagered = 0;
- num = 0;
- betSize = 0;
- } else {
- bet = 0;
- totalWagered = 0;
- num = 0;
- betSize = 0;
- }
- }
Add Comment
Please, Sign In to add comment