[Tutor] Generating Deck Combinations

Michael Morrissey gdoghomes at gmail.com
Sat Jun 20 09:49:13 CEST 2009


I need to generate all possible deck combinations given two different lists
as input.

The Input:

List 1 has Card names listed inside it.
List 2 has Maximum Quantities for each Card name.

For example:

List1[0] would be: "Aether Vial"
List2[0] would be: "4"

List1[1] would be: "Mountain"
List2[1] would be: "10"

List1[2] would be: "Gempalm Incinerator"
List2[2] would be: "3"

etc.


A deck is 60 cards total (no more, no less). I need to loop over these lists
to generate all possible combinations of 60 card decks which use up to the
maximum quantity for each card.

So, from the example, I need to generate decks with '1' Aether Vial' and 59
other cards in all possible combinations (still within the maximum cap for
each card), and then I'd need to generate decks with '2' Aether Vial' and 58
other cards in all possible combinations

It is vital that I create all combinations and that the maximum quantities
are never breached.

I am hoping that the each deck could be output as two lists:

ListA = ['Cardname1', 'Cardname2', ...]
ListB = ['1', '2', ...]

These lists will have exactly 60 members.

If you have an idea of how to do this, please share it! =) I would be most
appreciative. I'll be testing all methods for speed because I have very
large amount of computing to do.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090620/0aff2702/attachment.htm>


More information about the Tutor mailing list