Deck mana curve
This commit is contained in:
parent
c820551baa
commit
10157dcade
1 changed files with 9 additions and 2 deletions
11
Magic.hs
11
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])))
|
||||
|
|
Loading…
Reference in a new issue