var pout = 2; var minloss = 100; function debounce(func, wait, immediate) { var timeout; return function executedFunction() { var context = this; var args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; function roundUp(num, precision) { return Math.ceil(num * precision) / precision } function calculatorupdate() { var chance = parseFloat($("#tx_chance").val()).toFixed(8); var raise = parseFloat($("#tx_loss").val()).toFixed(8); var startBank = parseFloat($("#tx_bank").val()).toFixed(8); var curBank = parseFloat($("#tx_bank").val()).toFixed(8); var curBet = $("#tx_amount").val(); var odds = 0; if (chance > 0 && raise > 0 && curBank > 0 && curBet > 0) { pout = (98 / chance); $("#tx_payout").html(pout.toFixed(4)); minloss = (100 / (pout - 1) + 19); $("#tx_minLoss").html(roundUp(minloss, 10000)); var curRaise = 1 + raise / 100; var nBet = 1; var win = parseFloat(0).toFixed(8); var betSum = parseFloat(0).toFixed(8); var profit = parseFloat(0).toFixed(8); var bankPercent = 0; if ($("#results").length) $("#results").remove(); $("
| # | Bet | Sum of Bets | of Bank | Bank After Loss | Win | Profit | Odds of Losing Streak |
A persistence of this strategy is " + ((nBet - 1) / parseFloat($("#tx_payout").html())).toFixed(1) + " (Higher is better)"); } } $("#tx_chance").keyup(debounce(calculatorupdate, 550)); $("#tx_chance").change(debounce(calculatorupdate, 550)); $("#tx_bank").keyup(debounce(calculatorupdate, 550)); $("#tx_amount").keyup(debounce(calculatorupdate, 550)); $("#tx_loss").keyup(debounce(calculatorupdate, 550));