simple underscore.js projects, walk through, & tutorial


Lottery DataBase Analysis - 09 (while)


Not much from the underscore library this time around.




    document.getElementById('outputOne').innerHTML = "1 Ticket Chance Big Prize = " + lotteryData[0].numWinners/numTickets;

1 Nada Yet


    document.getElementById('outputTwo').innerHTML = "20 Ticket Chance Big Prize = " + 20 * lotteryData[0].numWinners/numTickets;

2 Nada Yet


    document.getElementById('outputThree').innerHTML = "1 Ticket = 1 in " + numTickets / lotteryData[0].numWinners;

3 Nada Yet


    document.getElementById('outputFour').innerHTML = "20 Ticket = 1 in " + numTickets / lotteryData[0].numWinners / 20;

4 Nada Yet



// input size of bet
// returns "Action" or Number of Plays
function numberOfPlaysFrom$$$(moneyToPlay){
   
    var expectedLowValueReturn = returnPerTicket - lotteryData[0].returnPerThis;
    var plays = 0;
   
    while (moneyToPlay > ticketPrice){
        moneyToPlay -= ticketPrice;
        moneyToPlay += expectedLowValueReturn;
        plays += 1;
    }
      return plays;
}


    document.getElementById('outputFive').innerHTML = '20 Tickets with Reinvested Winnings = ' + numTickets / lotteryData[0].numWinners / numberOfPlaysFrom$$$(100);


5 Nada Yet


    document.getElementById('outputSix').innerHTML = '20 Tickets, Reinvested Winnings, Number of Plays = ' + numberOfPlaysFrom$$$(100);

5 Nada Yet



Permanent Display Stat area
nada yet
nada yet
nada yet
nada yet
nada yet
nada yet
nada yet


_.moreUnderscoreProjects

© Copyright 2013 Brett Paufler


Please Note: I am an idiot.  No seriously.  The odds of my gambling odds calculations being correct are likely on par with my odds of ever winning.  You have been warned.