var baseBet = 1, // 10 bits
baseCashout = 10, // Cashout at x1.28
maxLoss = 50; // Amount of loss the bot will keep betting.
var Simulation = false; // (true/false) Setting this to true will make the bot to simulate a betting run.
//// ^EDIT OVER THIS LINE^ \\\\
var bet = baseBet;
var cashout = baseCashout;
var lastBet = bet;
var lossStreak = 0;
var firstGame = true;
var profit = 0;
var chill = false;
var wins = 0;
var loss = 0;
engine.on('game_starting', function(){
if(lossStreak<maxLoss){
console.log("Betting "+bet+" Bits on x"+cashout);
if(Simulation){
lastBet = bet;
}else{
engine.placeBet(bet*100, (cashout*100), function(){
lastBet = bet;
});
}
}else{
console.log("Max loss reached! Passing one game then resetarting.");
chill = true;
bet = baseBet;
cashout = baseCashout;
lossStreak = 0;
}
});
engine.on('game_crash', function(data){
if(data.game_crash/100<cashout && !firstGame && !chill){
loss++;
console.log("Game crashed under x"+cashout+" :( ("+wins+" Wins | "+loss+" Loses)");
profit -= lastBet;
console.log("Current Profit: "+profit.toFixed(2));
lossStreak++;
if(lossStreak==1){
cashout = 10;
bet = 1;
}
if(lossStreak>2){
cashout = 10;
bet = 1;
}if(lossStreak>3){
cashout = 10;
bet = 1;
}if(lossStreak>4){
cashout = 10;
bet = 2;
}if(lossStreak>5){
cashout = 10;
bet = 2;
}if(lossStreak>6){
cashout = 10;
bet = 3;
}if(lossStreak>7){
cashout = 10;
bet = 4;
}if(lossStreak>8){
cashout = 10;
bet = 5;
}if(lossStreak>9){
cashout = 10;
bet = 6;
}if(lossStreak>10){
cashout = 10;
bet = 7;
}
if(lossStreak>11){
cashout = 10;
bet = 8;
}if(lossStreak>12){
cashout = 10;
bet = 10;
}if(lossStreak>13){
cashout = 10;
bet = 12;
}if(lossStreak>14){
cashout = 10;
bet = 14;
}if(lossStreak>15){
cashout = 10;
bet = 16;
}if(lossStreak>16){
cashout = 10;
bet = 18;
}if(lossStreak>17){
cashout = 10;
bet = 21;
}if(lossStreak>18){
cashout = 10;
bet = 24;
}if(lossStreak>19){
cashout = 10;
bet = 27;
}if(lossStreak>20){
cashout = 10;
bet = 31;
}if(lossStreak>21){
cashout = 10;
bet = 35;
}if(lossStreak>22){
cashout = 10;
bet = 40;
}if(lossStreak>23){
cashout = 10;
bet = 45;
}if(lossStreak>24){
cashout = 9;
bet = 51;
}if(lossStreak>25){
cashout = 9;
bet = 58;
}if(lossStreak>26){
cashout = 9;
bet = 66;
}if(lossStreak>27){
cashout = 9;
bet = 75;
}if(lossStreak>28){
cashout = 9;
bet = 85;
}if(lossStreak>29){
cashout = 9;
bet = 96;
}if(lossStreak>30){
cashout = 9;
bet = 110;
}if(lossStreak>31){
cashout = 9;
bet = 125;
}if(lossStreak>32){
cashout = 9;
bet = 142;
}if(lossStreak>33){
cashout = 9;
bet = 162;
}if(lossStreak>34){
cashout = 9;
bet = 185;
}if(lossStreak>35){
cashout = 9;
bet = 210;
}if(lossStreak>36){
cashout = 9;
bet = 240;
}if(lossStreak>37){
cashout = 9;
bet = 272;
}if(lossStreak>38){
cashout = 9;
bet = 310;
}if(lossStreak>39){
cashout = 9;
bet = 350;
}if(lossStreak>40){
cashout = 9;
bet = 400;
}if(lossStreak>41){
cashout = 9;
bet = 452;
}if(lossStreak>42){
cashout = 9;
bet = 520;
}if(lossStreak>43){
cashout = 9;
bet = 600;
}if(lossStreak>44){
cashout = 9;
bet = 680;
}if(lossStreak>45){
cashout = 9;
bet = 770;
}if(lossStreak>46){
cashout = 9;
bet = 880;
}if(lossStreak>47){
cashout = 9;
bet = 1000;
}if(lossStreak>48){
cashout = 9;
bet = 1120;
}if(lossStreak>49){
cashout = 9;
bet = 1260;
}if(lossStreak>50){
cashout = 9;
bet = 1425;
}if(lossStreak>51){
cashout = 9;
bet = 1625;
}
}else{
if(!firstGame && !chill){
wins++;
console.log("Successful bet! :) ("+wins+" Wins | "+loss+" Loses)");
profit += ((lastBet*cashout)-lastBet);
console.log("Current Profit: "+profit.toFixed(2));
bet = baseBet;
cashout = baseCashout;
lossStreak = 0;
}
}
firstGame = false;
if(chill) chill = false;
});
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2");
}