diff --git a/Magic.hs b/Magic.hs index 3c2b054..af52235 100644 --- a/Magic.hs +++ b/Magic.hs @@ -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])))