On 23/03/2012 23:18, Edward Saxton wrote:
It still needs a way to identify valid sets. Also scaling it up to all
sets of six sided dice (num=6 and high=19) or sets of more than three
dice is probably going to take more work. If I can find the time those
are problems for Sunday.
Here's completed code that manages to find the example dice we were
looking at.
https://gist.github.com/2320601
Running it on my computer for all sets of three, three sided dice it
takes about 8 seconds to find 57 sets if duplicated sides on a dice are
allowed e.g. (3, 6, 9), (4, 7, 7), (5, 5, 8) and just under a second if
they're not finding (1, 5, 9), (2, 6, 7), (3, 4, 8) and (1, 6, 8), (2,
4, 9), (3, 5, 7). All of these results have the same 4/9 v 5/9 bias.
If anyone can see improvements to let fast enough to search dice with
more sides, or how to make it search sets of more dice I'd be glad to
hear them.
Ed
--
To post: [email protected]
To unsubscribe: [email protected]
Feeds: http://groups.google.com/group/python-north-west/feeds
More options: http://groups.google.com/group/python-north-west