Main Menu
LottoSim 4 Visual Basic

A    S i m p l e    L o t t e r y    S i m u l a t i o n    a n d    A n a l y s i s    P r o g r a m

VERSI ON 1.0 AS OF:  APRI L 19, 1994   ---   BY:    Bob Yewchuk   Docs: v1.00

Introduction

The  Program

Technical  Stuff


Introduction
I never win --- So why do I keep buying tickets ?

Although we as human beings may feel comfortable in the fact that we've reached the top of the evolutionary scale, there are still two things that make us revert to the savage and irrational behaviour of our distant ancestors:  the first is, a big sign that says "50% off --- One Day Only!", and the second is a  "Pick6"  lottery.  First of all,  I want to admit that I am not immune to this phenomenon.  I like to think that I am reasonably adept with numbers, and can manipulate them fairly easily, but when buying a lottery ticket, I lose my calm, orderly, methodical outlook, and become consumed with meaningless trends, and gut feelings.  6/49 changes me from a cool and logical Mr. Spock, into a raving, maniacal Dr. McCoy  (Dammit Jim! --- I lost again!).

But, at least I am not the only one whose judgment wanes...

I was waiting in line in a variety store a while ago, behind a middle-aged woman who was buying Wintario tickets.  She made the clerk take out that blue plastic tray from under the glass, so that she could get a good look at them.  She was certainly taking her time, but I dared not disturb her, because I knew that this was an intensely personal moment for her.  She looked at the rows of tickets over and over again, eyes scanning back and forth, until she finally stopped at one, studied it for a moment, held it up to the clerk, and said  "Ooooh... these are good numbers... (long pause) ....aren't they?".  (To which the bored clerk obviously nodded).  I knew then, that it was time to start work on my lottery idea...

What Is Lotto-Sim Anyway?


What Is Lotto-Sim ?
So --- will this program make me rich ?

First of all, I should explain what LottoSim is NOT. It is not a number picking system, it is not a trend or number frequency analyzer, and it does not claim to improve your odds of winning. LottoSim is a small lottery simulator, which will emulate a "Pick-6" lottery on your PC. When the simulation is complete, the program will do modest statistical and graphical analysis of the simulation.

Before writing this program, I looked at some other lottery programs and devices to see what they did and didn't do.  From my modest research, I've discovered that two major categories: random number generators, and the  "analysis"  programs.  The complaint I have with these programs, is that they appeal to the user's baser emotions.  These programs claim to help you pick winning combinations (greed), or imply that they have some secret way of beating the system (larceny).  Unfortunately, they also reveal very little about the finer details of the lotteries,  and do not let the user explore or discover things on his/her own.

a) Random Number Generators:  These are advertised with taglines such as:  "choose your winning number combinations the same way the professionals do" or  "a scientific method of picking million dollar winners".  Many of these are calculator-like devices that do nothing more than generate random numbers from 1-49 (which your PC can do for free).  There are even computer programs (that sell for up to $19.99!) that do only this.

b) Analysis Programs:  Some analyze a database of all the past winning numbers, and will pick the ones that come up the least --- the theory being that since all numbers will (eventually) be picked roughly the same number of times,  then these numbers are  "due any time now".  Others also use a database and claim to track numbers which have been picked most often, and numbers that appear together.  They offer hit and miss frequencies, trends, patterns and repeat occurrences,  all gathered from a list of "winning statistics".  All of this claims to help you design "powerful probability studies".

A Look at Random Numbers

While it's true that random numbers will eventually yield a roughly even  distribution, the flaw in logic in the latter two programs is that past  performance cannot be used as a determinant of future performance.  For example,  if a couple has seven children,  all girls,  then it would be  reasonable for one to say that they are "due" for boy.  Are they?  If I flipped a coin, and asked you to tell me the odds of it coming up tails,  you would quite correctly say that they are 50/50.  Now, what if  told you that I had just flipped the coin 15 times,  and each time, it came up heads.  Would your answer be different, now that you know this?  Should it be?

LottoSim Appeals to the User's Intellect

I am not going to try to impress or mislead you with semantics.  I believe that labeling any set of random numbers "winning statistics" will allow one's emotions (greed) to surface,  thus diminishing the user's objectivity.  I refuse to market this program by using any form of sensationalism.  Hence,  I will not use any lists of "winning" numbers,  I will not claim that this program will help you become a millionaire,  and any probability studies that you do,  will be only as powerful as your inferences from them.  With this program,  I appeal to the user's reason and objectivity and intellect --- not to his/her greed.  My target audience is one whose members enjoy intellectual exploration for its own sake;  people who are rarely satisfied with the status quo, and always try to make things more efficient;  people who like looking at old things in new ways,  and hope to discover something new...

Program Features


Program Features
FEATURES

- Visual Basic interface makes it ridiculously easy to use

- 6/49 and Lottario (6/45) default lottery settings

- Custom lotteries (6/12 - 6/99)

- Quick Pick or user number selection

- Modifiable prize values and ticket prices

- Auto prize scaling

- Sound Effects

- Odds of winning for all lotteries

- Cash Distribution graph to screen or printer

- Graph of Return on Investment to screen or printer

- Self-scaling ROI graph

- Tickets per Second display

- Last but not least --- it's free! (see Postcard-ware notice)

Machine Requirements


MACHINE REQUIREMENTS

- A PC capable of running Windows 3.1

- VBRUN300.DLL

- A pointing device (recommended)

- Sound Driver for PC Speaker (optional)

To ensure consistent operation over a broad range of PC configurations, this program was written for a 640x480 screen resolution, using 16 colours.

Copyright Notice


Copyright Notice
COPYRIGHT

Lotto-Sim:  © 1994 by Bob Yewchuk

Copyright is retained by the author. This program is not in the public domain, but may be freely distributed as long as the following conditions are met:

1. All files in the archive are included, and are unaltered.

2. This package may not be sold, or included in any commercial package.

A nominal fee may be charged, to cover the cost of disks and distribution. The author assumes no responsibility for any damages resulting from the use (or inability to use) this program.

Postcard-Ware


About Postcard-ware
POSTCARD-WARE

This program is fully-featured,  contains no nag screens,  time delays or disabling devices, and is absolutely FREE!  (There --- that's what you wanted to hear,  wasn't it?)

In January 1992, I released a shareware version of this program for the Commodore Amiga.  My request then, was a simple one:  "No dollar figure,  just send whatever you think the program is worth". As of April 1994, my net proceeds stand at $0.00 (and counting...).

This time, I re-wrote the program from the ground up, taking full advantage of the Windows interface, and adding many new features. I'm not doing this to make my living, but I would like to know that people are enjoying my program, and that, in a small way,  I'm contributing something to the PC community.

Postcard-ware is a term I made up (I've always wanted to coin a phrase...) which describes this program. I realize that this is just a novelty program --- something that you'll probably use for a couple of days,  and then file away somewhere (unlike file compression,  graphics manipulation and other utility programs which become part of your arsenal);  that's why I'm not asking for any money. However,  during those two days,  and before you get bored with it,  please send me a postcard from your home town or city,  and write your comments on the back (what you liked,  or didn't like;  future enhancements;  bug reports; shameless praise...  you know, that sort of thing).  I will consider,  and try to incorporate any suggestions into future revisions.

I'm also very interested in finding out how far this program has traveled;  so the farther away you live from Toronto,  the more I would like to hear from you!

If you just can't afford a postcard and a stamp, then feel free to send me an E-Mail message:

INTERNET:    Bob.Yewchuk@CANREM.COM

Otherwise, please send a Postcard to:

BOB YEWCHUK

28 ELIZABETH  STREET, APT. 304

MISSISSAUGA, ONTARIO, CANADA

L5G  2Z6

Menu Items


Menu Items
The Main Screen Menu Items

Instructions

     Choose Numbers

          Parameters

               Quit

                    Prize Values

                         Ticket Price

                              Auto Prizes

                                   TPS Value

                                        Return On Investment

                                             Cash Distribution

                                                  Your Odds of Winning

                                                       Default Lotteries

                                                            Custom Lotteries

                                                                 Sound Effects

                                                                      About The Program


Instructions
If you're like me, then you don't usually read the docs until you're really stuck. Therefore, the instructions menu item gives you enough information to get you started on a standard simulation. Afterwards, just play around with the different options and try to figure them out.


Choose Numbers
Selecting this menu item (or clicking the selected numbers on the Main Screen) brings up a dialog with two buttons; allowing the user top select either a Quick Pick or Choose Your Own option. The user will then be able to enter his or her own choices, or select (and re-select) six random numbers.


Parameters
Selecting this menu item (or clicking on the Standard Simulation box on the Main Screen) displays a dialog box box allowing the user to enter the simulation parameters. Pressing the recycling symbol starts the Continuous Simulation mode; this mode can be halted only by pressing the ESC key. In the Standard mode, enter the number of tickets per screen update, press TAB, and then enter the number of screen updates. See the Instructions screen for more details.


Recycling Symbol
Yes! I know! It's a @#?& recycling symbol! I've been looking through hundreds of icons, trying to find something that will effectively represent the continuous aspect of a simulation. After an exhaustive search, it was the only icon which truly captured its essence...


Quit Program
Duh!!!


Prize Values
Displays a dialog which allow the user to enter prize values from $1 to $999,999,999. Remember, don't stifle your creativity --- who says that the second or third prizes have to be less than the first? And, why not design a (profitable) lottery which rewards people for not matching any numbers?!!


Ticket Price
Displays a dialog allowing the user to enter a ticket price between $0.01 and $99.99.


High Ticket Price
I know that $99.99 sounds a little arbitrary, but I had to choose a range (and believe me --- I'm the last person to limit your imagination). For all I know, someone may have a Darn Good Reason for selling tickets for $500,000 (or whatever), in a particular simulation. So --- if this range really bothers you, please send me a postcard explaining your new proposed upper limit, (and your darn good reason), and I'll do my best to incorporate it into the next version.


Auto Prizes
Scales the prize values up or down proportionally to the ratio of:  the odds of  the 6/49 lottery, to the odds of the current lottery. However, the user can still change the prize amounts; the Prize Values option overrides the Auto Prize option. The following is an example of the changes in the prize values when switching to a 6/44 and a 6/57 lottery with the Auto Prize option enabled:

             6/49                     6/44	            6/57

Odds   1 : 13,983,816	         1 : 7,059,052        1 : 36,288,252

First       1,500,000               757,202.38             3,892,526

Second        300,000               151,440.47               778,505

Third           3,000                 1,514.40                 7,785

Fourth             80                    40.38                   207

Fifth              10                     5.04                    25


TPS Values
Displays a dialog box which allows you to either re-calculate or manually change the initial Ticket per Second value. Please see the technical menu for more details, or click here.


Return On Investment
Displays a graph of the Return On Investment. Data is collected during each screen update, and the menu option is enabled after the simulation is over. If the simulation is in the Continuous mode or has been aborted, the menu item remains disabled.


Cash Distribution Graph
Displays a pie chart, showing how your investment has been allocated among the various prizes and the Lotto Corp.


Odds of Winning
This option displays the odds of matching all six numbers for the current lottery.


TECHNICAL MENU

Simulation Limits

Aborting the Simulation

Mouse Shortcuts

Tickets per Second

Random Numbers

Things to Think About

Things You Shouldn't Do

Undocumented Featues (Bugs)

Development History

Future Plans

Title Page


Abort Simulation
Aborting The Simulation

The simulation may be stopped at any time by pressing the ESC key. A dialog box will appear asking you to confirm your decision.

Technical Details

- After pressing ESC, you may have to wait a while before the dialog box appears. That's because the program checks for it at the end of each cycle (except in the Continuous mode, when it checks after every 100 tickets). I did this on purpose because I wanted a nice tight calculation loop, and checking for key presses all the time would slow things down. Admittedly, if the time between cycles is more than a few seconds, it can be somewhat annoying because the Abort Sim dialog box won't appear for a while, and then after selecting either Yes or No, the system won't respond to your mouse click... Again, this is all in the name of optimization; I believe that it's more important to squeeze every bit of speed out of the machine than to have instant aborts.

- After the dialog box appears, the simulation keeps running. This way, no time is wasted suspending the simulation while the user decides what to do.

- After pressing YES or NO on the dialog box, there is another delay. The program does not acknowledge the keystroke until the end of the current cycle.

- If the simulation is aborted, the Return On Investment Graph is disabled. This arises out of the program's use of the GRAPH.VBX feature. Before running a simulation, the number of graph data points must be defined. The VBX then allocates that many empty spaces for the graph. If they are not all filled up, then the graph appears distorted, (and the graph line drops down to zero for the unused portion). The Return On Investment graph is also disabled when running the Continuous simulation, since it is impossible to determine the number of screen updates beforehand.

- Another limitation of the GRAPH.VBX is that it is limited to 3800 data points.  Usually, when the user is entering the parameters, the program sets the number of graph data points to equal the number of screen updates (the actual screen update data is used for the graph). If there are more than 3800 screen updates, then only the first 3800 will be graphed.

Mouse Shortcuts


Mouse Shortcuts

Feature              On the Main Screen, click on:

Choose Numbers       Any number box in the Selections area

Parameters           Standard (or Continuous) Simulation label

Ticket Price         Ticket price or its label

Prize Values         Prize Values

Lottery Type         Lottery Type label

TPS Values           Tickets per Second or its label

Ticket per Second


Tickets Per Second
Calculating the Tickets per Second

There are two distinct TPS variables used in the program.

When the program is first run, it attempts to determine how fast your processor is, and runs a mini-simulation of 200 tickets. I chose 200 because it seems to be the smallest sample size which will yield consistent results over many executions. Using the difference between the starting and ending times, a TPS figure is determined, which is used in the simulation duration calculations. It can be changed by selecting the TPS Values menu item, or by clicking on the Tickets per Second label or number on the Main Screen.

When the simulation is in progress, a second variable is used to calculate the TPS for each screen update. Its value varies constantly, and does not affect the first TPS variable.

Random Numbers


Default Values
       6/49	 Lottario

Number Range  :	1 - 49              1 - 45

Ticket Price  :	 $1.00               $0.50

First Prize   :	   1,500,000             250,000

Second Prize  :        300,000              25,000

Third Prize   :          3,000               1,500

Fourth Prize  :             80               	40

Fifth Prize   :             10	 5


Custom Lottery
Displays a dialog box in which the user selects a lottery from 6/12 to 6/99. Selecting 49 or 45 will automatically reset the 6/49 and Lottario default lotteries, respectively.


 Sound   E f f e c t s

Two categories:  End Of Simulation,  and First Prize

Three options for each:  None,  Beep,  and Wave (.WAV file)


About The Program
Describes Postcard-ware, the philosophy behind it, and how to contact the author.


Things to Try
Things To Think About

One of the things I hope to accomplish with this program, is a little intellectual exploration. I want you to think about lotteries and their structure in new ways, and maybe come up with some new designs of your own. If you have any ideas which can't be simulated with this program, please send me a postcard, and I will try to incorporate them in future revisions. But, in the meantime:

- What percentage of the Lotto 6/49 lottery income is paid out in prizes?  Is it the same for Lottario?

- Now that you know the odds and prize payouts, which lottery would you rather play: Lotto 6/49 or Lottario?

- How much money does the Lotto Corp. make each week?

- If the odds and the prize amounts of Lotto 6/49 were each doubled (becoming a 6/55) or tripled (a 6/58), do you think that this new lottery be as popular?

- Would a lottery with a smaller grand prize but more minor prizes be successful?

- In the spring of 1992, Lottario was changed from a 6/39 game with $1.00 tickets, to a 6/45 game with two tickets for a dollar. Which game gave you better odds of winning?

Bugs


Simulation Limits

Default Lotteries   :   6/49,  6/45

Custom Lotteries    :   6/12 - 6/99

Number Selection    :   Quick Pick, User Input

Simulation Size     :   Up to 100 billion tickets

Tickets per Second  :   Depends on processor speed

Prize Values        :   0 --- 999,999,999

Ticket Price        :   0.01 --- 99.99

Graph Data Points   :   2 - 3800

Sound Effects       :   Beep, .WAV files


File Sizes


Program Bugs
Undocumented Features & Strange Behaviours

The GRAPH.VBX doesn't print the graphs properly; specifically, the gridlines and labels. However, this may just be specific to my printer. In the meantime, I'll keep testing different property settings...

In the 3D Pie chart, the GRAPH.VBX does not paint the side panels of the white pie slice (the category where one number is matched). My guess is that this utility was developed and tested using a white background, and that the omission went unnoticed.

If you display the graph labels on the pie chart, you will notice lines between the pie segments. This is a limitation of the GRAPH.VBX again. Before displaying the graph, the number of data points (which translate into the number of different prize categories) must be set in advance. Although I could count the categories after the simulation, and then start building the graph, each data point uses a colour in a certain sequence. To keep the graph colours consistent (that is, each prize category will always be represented by the same colour), I decided to set the maximum number of data points for this graph, and leave the lines in.

That should be it, as far as I know...

Development History


Prize Colours

Matching 6 Numbers:  Blue

Matching 5 Numbers:  Green

Matching 5 + Bonus:  Cyan

Matching 4 Numbers:  Red

Matching 3 Numbers:  Magenta

Matching 2 Numbers:  Yellow

Matching 1 Number:   White

Matching 0 Numbers:  Dark Blue

Lotto Corporation:   Dark Green


Random Numbers
RANDOM NUMBERS ON PCS

As you know, the random number generators in PCs aren't truly random. Instead, they pick a pre-determined series of numbers, based on the seed, or argument given to the random number function. This sequence may be changed by either changing the seed, or adding a Randomize statement just before calling the function.

In order to make the numbers as random as possible, I use the Randomize statement in the following places in the program:

--- each time the Quick Pick form is selected

--- just before each simulation is run

In this version, the random number seed is 1, and cannot be modified; but that option could be added in a future version if a user requests it.

Things To Think About


Things You Shouldn't Do
Oh I don't know --- don't pick your nose in public ?


DEVELOPMENT HISTORY

No history for the VB edition,  but if you really want to know about the evolution...

1986 --- Wrote a modest lottery simulation program on the Commodore 64.

1988 --- Re-wrote it on the Commodore Amiga using GFA BASIC

1991  --- Re-wrote and enhanced it on the Amiga using HiSoft BASIC

1992 --- Released LottoSim for the Amiga as Shareware

1994 --- Total proceeds from that Amiga release, to date:  $0.00

Future Plans


F U T U R E   P L A N S

---  More default lotteries.

In this version (v1.00), only the 6/49 and Lottario Lotteries are listed as defaults. Well, there is a good reason for this:  these are the only ones I am familiar with.  If your lottery can't be simulated by this program, please send me some literature from your Lottery Corporation explaining all the details of that specific one, and I'll try to incorporate it into a future revision.

---  Whatever users suggest.

Technical Menu