var _settings = {
baseBet: 4, // 1 bit. Cannot be lower than 0.01.
bombs: 3, // 3 bombs. Cannot be lower than 1 or higher than 24.
multiply: 9, // Multiply the previous stake by 8 times if lost.
tiles: 1, // Amount of tiles to click before cashing out.
houseEdge: 1 // 1% House edge. Cannot be lower than 0.01 and max 100. (Do not touch if not sure)
};
// --- Edit over this line --- \\
var bet = _settings.baseBet, lastBet = 0, lastGame = null;
var houseEdge, odds, next;
var tilesClicked = 0;
console.log("[BOT] Starting Bot...")
$.post("https://api.moneypot.com/v1/hashes?access_token="+access_token, '', function(json) {
if(!connected) return;
Hash = (typeof json.hash === "undefined"?false:json.hash);
houseEdge = (_settings.houseEdge/100);
odds = ( (25-_settings.bombs-tilesClicked) / (25-tilesClicked) );
console.log("[BOT] Received first provably fair hash:", Hash);
placeBet();
});
function placeBet(){
//console.log("[BOT] Betting...");
odds = ( (25-_settings.bombs-tilesClicked) / (25-tilesClicked) );
var wager = (bet*100);
var rangeWin = Math.floor(Math.pow(2,32)*(odds));
next = ( bet * ((1.0-houseEdge)/odds) ) - bet;
$.ajax({
type: "POST",
contentType: "application/json",
url: "https://api.moneypot.com/v1/bets/custom?access_token="+access_token,
data: JSON.stringify({
client_seed: parseInt(game.clientSeed),
hash: String(Hash),
wager: wager,
"payouts": [
{from: 0, to: rangeWin, value: ((bet+next)*100)},
{from: rangeWin, to: Math.pow(2,32), value: 0}
]
}),
dataType: "json",
error: function(xhr, status, error) {
console.error("[BET ERROR]",xhr.responseText);
console.alert("Important: Remember to not show your access token to anyone.");
return;
}
}).done(function(data){
lastBet = bet;
Hash = data.next_hash;
if(data.outcome >= rangeWin){ // lost
//console.log("[BOT] Lost bet.");
bet *= _settings.multiply;
lastGame = "lost";
tilesClicked = 0;
setTimeout(function(){placeBet();},100);
}else{ // win
//console.log("[BOT] Won bet.")
if(lastGame=="lost") bet = _settings.baseBet;
lastGame = "won";
tilesClicked++;
if(_settings.tiles>0 && tilesClicked<_settings.tiles){
bet = next + bet;
}else{
bet = _settings.baseBet;
tilesClicked = 0;
}
setTimeout(function(){placeBet();},100);
}
});
}