var placeBet=function(){
$.post( "action.php", { prizes: "125,20,1.52,1.42,1.32,1.32,1.22,1.12,0,1.12,1.22,1.32,1.32,1.42,1.52,20,125",
token: token,
secret:0,
bet:bet.current,
bits:bet.bits,
currency:bet.currency,
user_seed:makeid(),
act:"play",
v:ver,
})
.done(function( data ) {
if (!data.success){
alert(data.msg);
return 0;
}
var win=data.game_result.win;
var total_bet = data.game_result.total_bet;
console.log( win, data.data.balance );
if (win >= total_bet){
bet.current = bet.base;
if (bet.current < bet.base) bet.current = bet.base;
} else if (win < total_bet) {
bet.current = (bet.current-win) * bet.multiplier;
if (bet.current > bet.max) bet.current=bet.base;
}
placeBet();
}).fail(function() {
setTimeout(function(){placeBet();},5000);
});
}
//re-randomize our client seed to ensure provably faireness
function makeid(){
if (typeof window.crypto !== 'undefined' && typeof window.crypto.getRandomValues === 'function'){ //Check if CSPRNG is supported
var array = new Uint32Array(16);
window.crypto.getRandomValues(array); //Set each value in the array to random 32-bit CSPRNG values
var r='';
for (var i = 0; i < array.length; i++) {
r += String(array[i] + "-"); //Join all items in the array into a string with 256Bits of CSPRNG
}
return CryptoJS.SHA256(r).toString(); //Hash the string into a valid format for a user seed
} else {
return CryptoJS.SHA256(String(Math.random())).toString();
}
}
placeBet();