lib/Card.hs

119 lines
2.1 KiB
Haskell
Raw Normal View History

module Card where
data Flower =
Pine
| Plum
| Cherry
| Wisteria
| Iris
| Peony
| BushClover
| SusukiGrass
| Chrysanthemum
| Maple
| Willow
| Paulownia
deriving (Eq)
data Ribbon =
Red
| Blue
| Poetry
data Animal =
BushWarbler
| Cuckoo
| EightPlankBridge
| Butterflies
| Boar
| Geese
| SakeCup
| Deer
| Swallow
data Light =
Crane
| CampCurtain
| FullMoon
| RainMan
| ChinesePhoenix
data Value =
Plain
| Sand
| Lightning
| Ribbon Ribbon
| Animal Animal
| Light Light
data Card = Card {
flower::Flower
, value::Value
}
deck :: [ Card ]
deck = [
Card Pine Plain
, Card Pine Plain
, Card Pine (Ribbon Poetry)
, Card Pine (Light Crane)
, Card Plum Plain
, Card Plum Plain
, Card Plum (Ribbon Poetry)
, Card Plum (Animal BushWarbler)
, Card Cherry Plain
, Card Cherry Plain
, Card Cherry (Ribbon Poetry)
, Card Cherry (Light CampCurtain)
, Card Wisteria Plain
, Card Wisteria Plain
, Card Wisteria (Ribbon Red)
, Card Wisteria (Animal Cuckoo)
, Card Iris Plain
, Card Iris Plain
, Card Iris (Ribbon Red)
, Card Iris (Animal EightPlankBridge)
, Card Peony Plain
, Card Peony Plain
, Card Peony (Ribbon Blue)
, Card Peony (Animal Butterflies)
, Card BushClover Plain
, Card BushClover Plain
, Card BushClover (Ribbon Red)
, Card BushClover (Animal Boar)
, Card SusukiGrass Plain
, Card SusukiGrass Plain
, Card SusukiGrass (Animal Geese)
, Card SusukiGrass (Light FullMoon)
, Card Chrysanthemum Plain
, Card Chrysanthemum Plain
, Card Chrysanthemum (Ribbon Blue)
, Card Chrysanthemum (Animal SakeCup)
, Card Maple Plain
, Card Maple Plain
, Card Maple (Ribbon Blue)
, Card Maple (Animal Deer)
, Card Willow Lightning
, Card Willow (Ribbon Red)
, Card Willow (Animal Swallow)
, Card Willow (Light RainMan)
, Card Paulownia Plain
, Card Paulownia Plain
, Card Paulownia Sand
, Card Paulownia (Light ChinesePhoenix)
]
pair :: Card -> Card -> Bool
pair card1 card2 = flower card1 == flower card2