LuckyBit Promo Game

Design your own promo game to propose it!

by LuckyBitPromo

HTML

<body>
<h2>Design your <a href="http://luckyb.it" target="_blank"><span style="color: #008000;">L</span><span style="color: #299200;">u</span><span style="color: #5DA400;">c</span><span style="color: #9CB600;">k</span><span style="color: #C8AB00;">y</span><span style="color: #DA7C00;">B</span><span style="color: #EC4300;">i</span><span style="color: #DF0000;">t</span></a> promo game</h2>
<i style="font-size: 14px;">LuckyBit is the #1 on-chain bitcoin game in the world. <br/>
    Design your own game here, propose it on bitcointalk, if it gets selected<br/>
we will put it online for a period, and will share some of the profit with you!</i>
<br/>
<br/>
<br/>
<b>Multipliers:</b>
<table cellpadding="5" data-toggle="table">
    <thead>
        <tr>
            <th>Center</th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th>Extreme</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><input style="width: 55px;" id="mul0" onkeydown="timingWrapper();"/></td>
            <td><input style="width: 55px;" id="mul1" onkeydown="timingWrapper();"/></td>
            <td><input style="width: 55px;" id="mul2" onkeydown="timingWrapper();"/></td>
           <td><input style="width: 55px;" id="mul3"          onkeydown="timingWrapper();"/></td>
            <td><input style="width: 55px;" id="mul4" onkeydown="timingWrapper();"/></td>               
            <td><input style="width: 55px;" id="mul5" onkeydown="timingWrapper();"/></td>
            <td><input style="width: 55px;" id="mul6" onkeydown="timingWrapper();"/></td>
            <td><input style="width: 55px;" id="mul7" onkeydown="timingWrapper();"/></td>
            <td><input style="width: 55px;" id="mul8" onkeydown="timingWrapper();"/></td>
        </tr>
    </tbody>
</table>
<br/>
<br/>

<b>Max amount players can play:</b><input class="in" id="maxAmount"...

JavaScript

//debugger;
var timer;
timingWrapper = function(){
    window.clearTimeout(timer);
    $('#checkResults').text('');
    timer = window.setTimeout(checkResults, 300);
};
checkResults = function(){
//    timer = null;
    resetResults();
    if (!allFieldsPresent()) {
         $('#checkResults').text('Some fields are missing!');
         $('#checkResults').css('color', 'red');
         return;
    }
    if (!allFieldsNumerical()) {
         $('#checkResults').text('Some fields are not numerical!');
         $('#checkResults').css('color', 'red');
         return;
    }
    if (!multipliersBigEnough()) {
         $('#checkResults').text('All multipliers must be larger or equal to 0.2');
         $('#checkResults').css('color', 'red');
         return;
    }
    if (!multipliersTwoSignifDigitMax()) {
         $('#checkResults').text('Some numbers look really ugly... Try to do it with maximum two decimal digits!');
         $('#checkResults').css('color', 'red');
         return;
    }
    m0 = parseFloat($('#mul0').val());
    m1 = parseFloat($('#mul1').val());
    m2 = parseFloat($('#mul2').val());
    m3 = parseFloat($('#mul3').val());
    m4 = parseFloat($('#mul4').val());
    m5 = parseFloat($('#mul5').val());
    m6 = parseFloat($('#mul6').val());
    m7 = parseFloat($('#mul7').val());
    m8 = parseFloat($('#mul8').val());
    max = parseFloat($('#maxAmount').val());
    
    odds = ((m8*(2.0/65536.0))+(m7*(32.0/65536.0))+(m6*(240.0/65536.0))+(m5*(1120.0/65536.0))+(m4*(3640.0/65536.0))+(m3*(8736.0/65536.0))+(m2*(16016.0/65536.0))+(m1*(22880.0/65536.0))+(m0*(12870.0/65536.0)))*100.0;
    maxWin = (max * Math.max(m0,m1,m2,m3,m4,m5,m6,m7,m8));
    $('#odds').text(odds.toFixed(3)+'%');
    $('#maxWin').text(maxWin);
    
    if (odds < 98.24 || odds > 98.5) {
        $('#odds').css('color', 'red');
        $('#checkResults').text('The odds are too far from the target (or below 98.24)');
        $('#checkResults').css('color', 'red');
        return;
    }
    else
...