Hello Colin, thanks for the invite.
When a new idea is presented or a challenge set, I usually try for
something totally different in the most difficult of manner. If
successful I have something which can be optimized a thousand fold in
VB6 or a combination VB6 and Assembly.
So too with this challenge, I thought for hours on a different
approach and began coding in Javascript.
The initial idea was to simplify the entire process and deduce some
results based on mathematical calculation alone – trying to suggest
that there are 20 subsets of 3 in every set of 6 and since there are
18,424 sets of three from for 6 numbers from 49, any given set of 6
listed as a cover would help eliminate x amount of the total
13,983,816. But it just would not fit together.
But I had progressed 90% of the way to a solution without knowing it.
In essence, the logic resembles the following:
List all 20 combinations of 3 from each set in a given list.
Map all of these onto an array of 18,242 elements.
Extract all 20 subsets of 3 from all 6/49 sets.
Search the mapped array for an instance of any subsets and count one
cover if found.
Sounds simple enough. But I found myself going in circles trying to
implement this in Javascript. I could see so many different methods to
use simply in VB6 and a straight forward approach in Assembly.
The resulting Javascript correctly counts all the covered 3 if 6 from
49 sets of that much talked about 163 set ‘world best’ wheel.
Trials:
3.00ghz Intel Win XP
FireFox: 411 seconds (6 min 51 secs)
IE 7: 1536 seconds (25 min 36 secs)
The usefulness of this is absolutely zero except to show off that I
used Javascript in the most complicated manner possible and still have
a semi-respectable processing time. It is available online at
http://www.iinet.net.au/~htjs/lottery/triplecover.htm
Draco Merest.