Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Module defining the player spots as well as the card spots.
Historically this was in Board
but was deported to a new file
to be visible both from Board
and Command
.
|
Synopsis
-
data Card
- = TopLeft
- | Top
- | TopRight
- | BottomLeft
- | Bottom
- | BottomRight
- data Player
- data Neighborhood
- data Line
- allCards :: [Card]
- allCardsNE :: NonEmpty Card
- bottomSpotOfTopVisual :: Card -> Card
- frontSpots :: [Card]
- backSpots :: [Card]
- inTheBack :: Card -> Bool
- inFront :: Card -> Bool
- line :: Line -> [Card]
- isCentered :: Card -> Bool
- neighbors :: Neighborhood -> Card -> [Card]
- switchLine :: Card -> Card
- toLine :: Card -> [Card]
- allPlayers :: [Player]
- startingPlayerSpot :: Player
- endingPlayerSpot :: Player
- other :: Player -> Player
Documentation
The spot of a card, as visible from the top of the screen. For the | bottom part, think as if it was in the top, turning the board | 180 degrees clockwise; or use these values and map [bottomSpotOfTopVisual].
Instances
Bounded Card # | |
Enum Card # | |
Eq Card # | |
Ord Card # | |
Show Card # | |
Generic Card # | |
PlayerIndexed (Map Card Fade) UI # | Generic access to the deco in |
PlayerIndexed (Map Card T) UI # | Generic access to effects in |
PlayerIndexed (Map Card Deco) Core # | Generic access to the deco in |
PlayerIndexed (Map Card (Creature Core)) Core # | Generic access to creatures in |
type Rep Card # | |
Defined in Spots
type Rep Card = D1 (MetaData "Card" "Spots" "main" False) ((C1 (MetaCons "TopLeft" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Top" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "TopRight" PrefixI False) (U1 :: Type -> Type))) :+: (C1 (MetaCons "BottomLeft" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Bottom" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "BottomRight" PrefixI False) (U1 :: Type -> Type)))) |
The position of a player
Instances
Bounded Player # | |
Enum Player # | |
Defined in Spots | |
Eq Player # | |
Ord Player # | Ord instance that makes explicit that |
Show Player # | |
Generic Player # | |
With Game (Kernel Player) # | |
Contains Game (Kernel Player) # | |
type Rep Player # | |
data Neighborhood #
The various kinds of neighbors
Cardinal | Neighbors to the left and the right |
Diagonal | Neighbors in diagonals |
All | Cardinal + diagnoal neighbors |
Instances
Eq Neighborhood # | |
Defined in Spots (==) :: Neighborhood -> Neighborhood -> Bool # (/=) :: Neighborhood -> Neighborhood -> Bool # | |
Show Neighborhood # | |
Defined in Spots showsPrec :: Int -> Neighborhood -> ShowS # show :: Neighborhood -> String # showList :: [Neighborhood] -> ShowS # | |
Generic Neighborhood # | |
Defined in Spots type Rep Neighborhood :: Type -> Type # from :: Neighborhood -> Rep Neighborhood x # to :: Rep Neighborhood x -> Neighborhood # | |
type Rep Neighborhood # | |
The back line, or the front line
Functions about CardSpot
allCardsNE :: NonEmpty Card #
All Card
values, as a non-empty list.
bottomSpotOfTopVisual :: Card -> Card #
Returns a bottom position, by taking a position that makes sense visually I.e. if you give this method [TopLeft], it'll correspond to the [TopLeft] bottom position that you SEE; even if positions make sense for the top part. This method takes care of translating correctly.
TODO smelc rename me to
bottomSpot@
frontSpots :: [Card] #
Spots on the frontline. TODO @smelc rename me to front.
isCentered :: Card -> Bool #
Whether a spot is in the center
neighbors :: Neighborhood -> Card -> [Card] #
switchLine :: Card -> Card #
Given a frontline spot, the corresponding backline spot. Given a backline spot, the corresponding frontline spot.
Functions about PlayerSpot
allPlayers :: [Player] #
All Player
values.
startingPlayerSpot :: Player #
The spot of the player that starts a game. FIXME @smelc rename to
starting
and use me qualified.
The spot of the player that ends a game