6 Pick Bet Grouping

bullockbefriending bard kinch1967 at gmail.com
Tue Nov 28 21:55:57 EST 2006


(I apologise in advance for posting something slightly OT, but plead in
mitigation that I'm trying to re-write an old, suboptimal VB6 (erk)
brute-force attack in a shiny, elegant, pythonic manner. I would really
appreciate some ideas about an appropriate algorithmic approach to this
+ pointers to any relevant implementations in Python. Along the way,
I'm also trying to get Python into my organisation through the back
door - so a further plea for tolerance in posting this here! :))

A single 6 Pick bet looks like this:
RACE1    RACE2    RACE3    RACE4    RACE5   RACE6
runner1 / runner 2 / runner 3 / runner4 / runner5 / runner6  - $amount

e.g. we might have:

5 / 3 / 11 / 7 / 1 / 9  - $50  (5 to come 1st or 2nd in Race1, 3 to
come first or 2nd in Race 2, etc.)
7 / 3 / 11 / 7 / 1 / 9  - $50
5 / 3 / 11 / 14 / 1 / 9  - $50
7 / 3 / 11 / 14 / 1 / 9  - $50

The totalizator system allows us to merge or group these four bets as
follows:

5 + 7 / 3 / 11 / 7 + 14 / 1 / 9 - $50  ($200 total)

This method of expressing multiple bets in one line is advantageous
because we may have many thousands of combinations we wish to bet and
only a limited amount of time in which to bet them.

There are up to 14 horses in each race, so 7,529,536 possible 6 Pick
bets. In practice, one might wish to bet (say)15,000 combinations out
of these 7.5 million. However, it would be very nice to be able to
*optimally* merge (as shown above) these 15,000 combinations so that
they might fit on (say)  2,000 betting tickets instead of trying to
write out 15,000 single tickets.

To keep things simple, let's assume that all single bets are for the
same amount. (In practice, however, this is not so.)

Now, it's certainly possible to go about this via brute force
iteration, but I would really appreciate it if anyone with a CS
background could point me toward a smarter plan of attack. I have
perused Skiena's Algorithm Handbook and various websites and can't seem
to find an analogous problem. I'm hoping this is just my ignorance and
that my brief exposition rings a bell for someone here.




More information about the Python-list mailing list