Deck mana curve

This commit is contained in:
Correl Roush 2011-10-14 01:31:33 -04:00
parent c820551baa
commit 10157dcade

View file

@ -55,5 +55,12 @@ data Card = Card Rarity String Cost
instance ManaCost Card where
converted (Card _ _ cost) = converted cost
deck = (replicate 13 (Card Land "Swamp" (Cost []))) ++ (replicate 13 (Card Land "Plains" (Cost [])))
++ replicate 4 (Card Mythic "Jace Beleren" (Cost [Mana 1 Colorless, Mana 2 Blue]))
data Deck = Deck [Card]
curve :: Deck -> [(Int, Int)]
curve (Deck cards) = do
let largest = maximum (map converted cards)
map (\x -> (x, length (filter (\(Card rarity _ cost) -> rarity /= Land && converted cost == x) cards))) [0..largest]
deck = Deck ((replicate 13 (Card Land "Swamp" (Cost []))) ++ (replicate 13 (Card Land "Plains" (Cost [])))
++ replicate 4 (Card Mythic "Jace Beleren" (Cost [Mana 1 Colorless, Mana 2 Blue])))