[kwlug-help] (Lottery) bash (?) programming - array, inlist, ???

unsolicited unsolicited at swiz.ca
Sun Jun 20 14:42:39 EDT 2010

The number of draws coming out of Lotto Max these days means it's 
getting irritating to confirm each week that, yet again, I haven't won 
a thing.

There are multiple number sets per ticket (>= 3), and multiple draws 
per date sometimes. (46 draws last Friday!) Each of 6 numbers, and one 
draw has a bonus number.

Seems to me there oughta be a reasonably simple way, or script, to 
check numbers, but I'm drawing a blank as to the core function's name 
to use.

Seems to me I want something like (excuse my pseudo code, it's been a 
long time since I've done any real scripting in anything ...)

Assuming arguments of a filename list of ticket numbers and a filename 
list of draws ...

for each line in draw
   for each line in ticket
    if( #1 inlist(draw) + #2 inlist(draw) + ... #7 inlist(draw) > 2 ) 
echo Winner, ticket X, draw Y.
    # Assuming true = 1, then the sum of the logical functions = a 
count. And > 2 means at least a free ticket.

But my mind is drawing a blank as to what to look for, an array 
function, a list function, a ???

Did find http://www.gnu.org/software/bash/manual/.

Anyone have the magic search term (function name) I can look up?

For that matter, anyone know of FOSS lottery software out there? I'm 
less concerned about the ability to go out to the web and get winning 
numbers, than just a quick lost again / free ticket indicator. 
Although, I gather some programs will do statistical analysis. I just 
can't recall any FOSS ones off the top of my head.

- a FOSS lottery software out there?
- what array? list? function name, e.g. inlist( search, element1, e2, 
en) have I seen but can't recall at the moment?

More information about the kwlug-help mailing list