I have been working on the poker example from a tutorial. I can generate a list form of the solution, but, am having trouble arriving at a solution using sets.
http://doc.sagemath.org/html/en/reference/combinat/sage/combinat/tutorial.html The tutorial goes through an example for flushes. Then, poses the four of a kind question. How do I get a solution similar to the one for flushes? Tom Dean The Flushes solution and my list solution: Suits = Set(["Hearts", "Diamonds", "Spades", "Clubs"]) Values = Set(["2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"]) Cards = cartesian_product([Values, Suits]) Flushes = cartesian_product([Subsets(Values, 5), Suits]) tmp = Arrangements(Values,2) FourOfKinds = [] for s in tmp: fourof = cartesian_product([{s[0]},Suits]) oddone = cartesian_product([{s[1]},Suits]) fourofkind = [] for t in fourof: fourofkind.append(t) for u in oddone: thishand = fourofkind[:] thishand.append(u) FourOfKinds.append(thishand) -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
