hand.py contains a Hand class that accepts a filename as input, generates a deck from the given file, and generates hands from that deck. It supports several functions:
Generates a new hand of the given size, contained within the Hand object, and returns a copy. Defaults to 7.
Accepts the name of a card or a list of names, returns 1 if the current hand contains any of those cards, 0 otherwise.
Accepts the name of a card or a list of names, returns the total number of those cards in the current hand.
Accepts the name of a card or a list of names and a hand size, returns the hypergeometric expectation of those cards in a hand of the given size.
Accepts a filename, a list of individual cards, or a dictionary of card names and quantities. Sets the deck and decklist to the input.
Returns a copy of the internal deck, a list of individual cards.
Returns a copy of the internal decklist, a dictionary of card names and quantities.
Returns whether the current hand contains Tron, counting the first Expedition Map. Will be deprecated when I find the motivation.
grixis_mana.py, grixis_mana_full, eldrazi_tron.py, and affinity.py contain applications. They all work essentially the same way. The main thing is implementing logic to classify the kinds of hands you're looking for.
grixis_mana.py tests to see how often checklands come into play untapped with a standard Grixis energy manabase. grixis_mana_full tries to find the optimal grixis manabase given a set of parameters that characterize an utility function. eldrazi_tron.py finds how often Eldrazi Tron gets its best draws. affinity.py finds how often Affinity plays a 2- or 3-drop on turn 1.
##Tests
Execute tests with pytest in root project dir