"Anton Vredegoor" <[EMAIL PROTECTED]> writes: > > def deals(): > > for i in xrange(13**5): > > cards = [(i//p) % 13 for p in (1, 13, 169, 2197, 28561)] > > yield cards > > This gives hands like [0,0,0,0,1] and [0,0,0,1,0] which are > permutations of one another.
Yes, that's intentional, I thought the idea was to figure out the probability of each type of poker hand, which means you have to count those multiple occurrences. > Below is a piece of code that avoids this. Nice. > Another hand, for example [0,0,1,2,3], would allow only 384 colorings,... > Similar things happen for other partionings of the hands into numbers... > > This is very fascinating. Maybe someday I'll make a tkinter script with > a visual tree structure allowing all kinds of numbers of "cards", and > arbitrary numbers of variables to partition by. Cool, I'd still like to know why (13**5)-13 = C(52,5) other than by just doing the arithmetic and comparing the results. Maybe your tkinter script can show that. -- http://mail.python.org/mailman/listinfo/python-list