Lottery Simulator

Remember, you can’t lose if you don’t play!

Download: Lottery Sim – 170kb

Ever wanted to lose a bunch of money playing the lottery without losing a bunch of money playing the lottery?  NOW YOU CAN!  This application simulates one of the big US lottery games.  The instructions aren’t really explained in game as it’s designed to be just like the real game.  I will go over them here, however.  Let me know what you think in the comments below!  btw I have tried to avoid any trademarks or other intellectual property intrusion for obvious reasons.

Instructions:
You will choose the number of lines or tickets first, this is like the number of computer picks the machine picks in a lottery kiosk.   Second you will choose whether or not you want the multiplier, this will double the cost of your tickets but at least double your winnings up to the top two tiers:  the second tier is always 5x and the jackpot is unaffected. 2-5 is randomly chosen as a multiplier for every other tier, per draw.  Draws are a little redundant with no waiting 3 days between them, but there is a subtle difference and further it’s included in the real game so I through it in the mix.  This will multiply the cost of your ticket by the number of draws, but will cause your tickets to draw in that many draws.  For example 2 tickets and 3 draws will be 6 dollars with six chances to win: a winning combination will be chosen, you will try two times, then another, two more tries and finally a third, and two final tries.  You start the game with $100,000 good luck and enjoy losing!  [side note: the chances are as close as I could make them but for technical reasons (see below) you may win a little more frequently than you should]

Geek stuff:
The game is pretty true to life, for example: it would be easier to just use the chances of winning, but instead I actually calculate the winning ticket and each of your tickets and see if they won just like reality.  You can’t draw two identical numbers on any one line.  There are a couple technical problems.  Number one is that you technically should maintain your same lines from one draw to the next only the winning number should change.  This wouldn’t be too difficult to fix but overall what I’ve got works, everything is recalculated every time, spins a little extra cpu time but doesn’t use as much RAM, not that that isn’t all negligible.  The second is I just use the stock Random function, which has poor distribution and high repeat-ability, it was really bad at first, I combated it by simply inverting the output for the winning combination: 1 is 59, 3 is 57 etc. this cut down on the unexpectedly high winning but it seems to still be higher than it should be.  I could probably swap this out with a better one fairly easily but it works I guess.

Todo: (maybe)
-simulate lottery jackpot increase and possibility of someone else winning each draw (including when you do).
-add a table of suggestions for ways of spending money based on how much you have left to emphasize that you could have bought a house but now you can only buy a cheeseburger.
-Just had a thought, to embellish the draws function, create a pause for each draw requiring you to press any key and allow you to review your winnings for the “night”.
-Another good idea, difficulties: Easy starts with $100,000 like the current, Medium starts with $1,000, Hard starts with $100, Reality starts with $20. With the lower difficulties available I should probably put the entire game in a while loop allowing you to try again over and over if you lose.  I really like this last idea I kinda want to implement it now but I already have it all uploaded and I have other things I need to work on for now, maybe I’ll do it later.

Advertisements