-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library implementing Halma rules -- -- Rules and diagrams-based renderer for the board game Halma on a -- hexagonal grid. @package halma @version 0.3.0.0 module Game.TurnCounter data TurnCounter p TurnCounter :: [p] -> Int -> TurnCounter p [tcPlayers] :: TurnCounter p -> [p] [tcCounter] :: TurnCounter p -> Int newTurnCounter :: [p] -> TurnCounter p nextTurn :: TurnCounter p -> TurnCounter p nextTurnWith :: (p -> Bool) -> TurnCounter p -> Maybe (TurnCounter p) previousTurn :: TurnCounter p -> TurnCounter p previousTurnWith :: (p -> Bool) -> TurnCounter p -> Maybe (TurnCounter p) currentPlayer :: TurnCounter p -> p nextPlayer :: TurnCounter p -> p previousPlayer :: TurnCounter p -> p currentRound :: TurnCounter p -> Int instance GHC.Base.Functor Game.TurnCounter.TurnCounter instance GHC.Show.Show p => GHC.Show.Show (Game.TurnCounter.TurnCounter p) instance GHC.Classes.Eq p => GHC.Classes.Eq (Game.TurnCounter.TurnCounter p) module Game.Halma.Board data HalmaGrid SmallGrid :: HalmaGrid LargeGrid :: HalmaGrid -- | Numbers of fields on each straight edge of a star-shaped halma board -- of the given size. sideLength :: HalmaGrid -> Int -- | Total number of fields on a halma board of the given size. numberOfFields :: HalmaGrid -> Int -- | The six corners of a star-shaped halma board. data HalmaDirection North :: HalmaDirection Northeast :: HalmaDirection Southeast :: HalmaDirection South :: HalmaDirection Southwest :: HalmaDirection Northwest :: HalmaDirection oppositeDirection :: HalmaDirection -> HalmaDirection leftOf :: HalmaDirection -> HalmaDirection -- | From the point of view of the given corner: On which row lies the -- given field? The row through the center is row zero, rows nearer to -- the corner have positive, rows nearer to the opposite corner negative -- numbers. rowsInDirection :: HalmaDirection -> (Int, Int) -> Int -- | The corner corresponding to a direction on a star-shaped board of the -- given size. corner :: HalmaGrid -> HalmaDirection -> (Int, Int) -- | The corner where the team starts. type Team = HalmaDirection -- | The position of the corner field where a team starts. startCorner :: HalmaGrid -> Team -> (Int, Int) -- | The position of the end zone corner of a team. endCorner :: HalmaGrid -> Team -> (Int, Int) -- | The start positions of a team's pieces. startFields :: HalmaGrid -> Team -> [(Int, Int)] -- | The end zone of the given team. endFields :: HalmaGrid -> Team -> [(Int, Int)] -- | Halma gaming piece data Piece Piece :: Team -> Word8 -> Piece -- | player [pieceTeam] :: Piece -> Team -- | number between 1 and 15 [pieceNumber] :: Piece -> Word8 -- | Map from board positions to the team occupying that position. data HalmaBoard getGrid :: HalmaBoard -> HalmaGrid toMap :: HalmaBoard -> Map (Int, Int) Piece -- | Construct halma boards. Satisfies fromMap (getGrid board) (toMap -- board) = Just board. fromMap :: HalmaGrid -> Map (Index HalmaGrid) Piece -> Maybe HalmaBoard -- | Lookup whether a position on the board is occupied, and lookupHalmaBoard :: (Int, Int) -> HalmaBoard -> Maybe Piece -- | A move of piece on a (Halma) board. data Move Move :: (Int, Int) -> (Int, Int) -> Move -- | start position [moveFrom] :: Move -> (Int, Int) -- | end position, must be different from start position [moveTo] :: Move -> (Int, Int) -- | Move a piece on the halma board. This function does not check whether -- the move is valid according to the Halma rules. movePiece :: Move -> HalmaBoard -> Either String HalmaBoard initialBoard :: HalmaGrid -> (Team -> Bool) -> HalmaBoard instance GHC.Classes.Eq Game.Halma.Board.Move instance GHC.Show.Show Game.Halma.Board.Move instance GHC.Show.Show Game.Halma.Board.HalmaBoard instance GHC.Classes.Eq Game.Halma.Board.HalmaBoard instance GHC.Classes.Ord Game.Halma.Board.Piece instance GHC.Classes.Eq Game.Halma.Board.Piece instance GHC.Show.Show Game.Halma.Board.Piece instance GHC.Generics.Generic Game.Halma.Board.HalmaDirection instance GHC.Enum.Enum Game.Halma.Board.HalmaDirection instance GHC.Enum.Bounded Game.Halma.Board.HalmaDirection instance GHC.Classes.Ord Game.Halma.Board.HalmaDirection instance GHC.Read.Read Game.Halma.Board.HalmaDirection instance GHC.Show.Show Game.Halma.Board.HalmaDirection instance GHC.Classes.Eq Game.Halma.Board.HalmaDirection instance GHC.Classes.Ord Game.Halma.Board.HalmaGrid instance GHC.Show.Show Game.Halma.Board.HalmaGrid instance GHC.Classes.Eq Game.Halma.Board.HalmaGrid instance Data.Aeson.Types.ToJSON.ToJSON Game.Halma.Board.HalmaGrid instance Data.Aeson.Types.FromJSON.FromJSON Game.Halma.Board.HalmaGrid instance Data.Aeson.Types.ToJSON.ToJSON Game.Halma.Board.HalmaDirection instance Data.Aeson.Types.FromJSON.FromJSON Game.Halma.Board.HalmaDirection instance Math.Geometry.GridInternal.Grid Game.Halma.Board.HalmaGrid instance Math.Geometry.GridInternal.FiniteGrid Game.Halma.Board.HalmaGrid instance Math.Geometry.GridInternal.BoundedGrid Game.Halma.Board.HalmaGrid instance Data.Aeson.Types.ToJSON.ToJSON Game.Halma.Board.Piece instance Data.Aeson.Types.FromJSON.FromJSON Game.Halma.Board.Piece instance Data.Aeson.Types.ToJSON.ToJSON Game.Halma.Board.HalmaBoard instance Data.Aeson.Types.FromJSON.FromJSON Game.Halma.Board.HalmaBoard instance Data.Aeson.Types.ToJSON.ToJSON Game.Halma.Board.Move instance Data.Aeson.Types.FromJSON.FromJSON Game.Halma.Board.Move module Game.Halma.Board.Draw defaultTeamColours :: Team -> Colour Double -- | Render the board using the helper function for drawing the fields. -- Supports querying for field positions. drawBoard' :: (V b ~ V2, N b ~ Double, Renderable (Path V2 Double) b) => HalmaGrid -> ((Int, Int) -> Diagram b) -> QDiagram b V2 Double (Option (Last (Int, Int))) -- | Render the board using the given team colors. Supports querying for -- field positions. drawBoard :: (V b ~ V2, N b ~ Double, Renderable (Path V2 Double) b) => HalmaBoard -> (Team -> Colour Double) -> QDiagram b V2 Double (Option (Last (Int, Int))) module Game.Halma.Configuration data HalmaPlayers a TwoPlayers :: a -> a -> HalmaPlayers a ThreePlayers :: a -> a -> a -> HalmaPlayers a FourPlayers :: a -> a -> a -> a -> HalmaPlayers a FivePlayers :: a -> a -> a -> a -> a -> HalmaPlayers a SixPlayers :: a -> a -> a -> a -> a -> a -> HalmaPlayers a data Configuration a configurationGrid :: Configuration a -> HalmaGrid configurationPlayers :: Configuration a -> HalmaPlayers a configuration :: HalmaGrid -> HalmaPlayers a -> Maybe (Configuration a) twoPlayersOnSmallGrid :: a -> a -> Configuration a threePlayersOnSmallGrid :: a -> a -> a -> Configuration a playersOnLargeGrid :: HalmaPlayers a -> Configuration a setSmallGrid :: Configuration a -> Maybe (Configuration a) setLargeGrid :: Configuration a -> Configuration a addPlayerToConfig :: a -> Configuration a -> Configuration a newGame :: Configuration a -> (HalmaBoard, TurnCounter (Team, a)) instance Data.Traversable.Traversable Game.Halma.Configuration.Configuration instance Data.Foldable.Foldable Game.Halma.Configuration.Configuration instance GHC.Base.Functor Game.Halma.Configuration.Configuration instance GHC.Show.Show a => GHC.Show.Show (Game.Halma.Configuration.Configuration a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Game.Halma.Configuration.Configuration a) instance Data.Traversable.Traversable Game.Halma.Configuration.HalmaPlayers instance Data.Foldable.Foldable Game.Halma.Configuration.HalmaPlayers instance GHC.Base.Functor Game.Halma.Configuration.HalmaPlayers instance GHC.Show.Show a => GHC.Show.Show (Game.Halma.Configuration.HalmaPlayers a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Game.Halma.Configuration.HalmaPlayers a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Game.Halma.Configuration.HalmaPlayers a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Game.Halma.Configuration.HalmaPlayers a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Game.Halma.Configuration.Configuration a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Game.Halma.Configuration.Configuration a) module Game.Halma.Rules data MoveRestriction -- | moves of this kind of field are allowed Allowed :: MoveRestriction -- | the player can pass the field but cannot occupy it Temporarily :: MoveRestriction -- | the player can't pass or occupy the field Forbidden :: MoveRestriction data RuleOptions RuleOptions :: MoveRestriction -> MoveRestriction -> RuleOptions -- | May pieces be moved backwards? [movingBackwards] :: RuleOptions -> MoveRestriction -- | May pieces be moved into other star corners? [invading] :: RuleOptions -> MoveRestriction -- | Computes all possible moves for a piece. possibleMoves :: RuleOptions -> HalmaBoard -> (Int, Int) -> [(Int, Int)] -- | Has a team all of it's pieces in the end zone? hasFinished :: HalmaBoard -> Team -> Bool instance GHC.Classes.Eq Game.Halma.Rules.RuleOptions instance GHC.Show.Show Game.Halma.Rules.RuleOptions instance GHC.Classes.Eq Game.Halma.Rules.MoveRestriction instance GHC.Show.Show Game.Halma.Rules.MoveRestriction instance Data.Aeson.Types.ToJSON.ToJSON Game.Halma.Rules.MoveRestriction instance Data.Aeson.Types.FromJSON.FromJSON Game.Halma.Rules.MoveRestriction instance Data.Aeson.Types.ToJSON.ToJSON Game.Halma.Rules.RuleOptions instance Data.Aeson.Types.FromJSON.FromJSON Game.Halma.Rules.RuleOptions instance Data.Default.Class.Default Game.Halma.Rules.RuleOptions module Game.Halma.AI.Base -- | A move of piece on a (Halma) board. data Move outcome :: HalmaBoard -> Move -> HalmaBoard data Rating WinIn :: Int -> Rating Rating :: Float -> Rating LossIn :: Int -> Rating rateTeam :: Team -> HalmaBoard -> Rating allOwnPieces :: HalmaBoard -> Team -> [Index HalmaGrid] allLegalMoves :: RuleOptions -> HalmaBoard -> Team -> [Move] instance GHC.Classes.Eq Game.Halma.AI.Base.Rating instance GHC.Show.Show Game.Halma.AI.Base.Rating instance GHC.Classes.Ord Game.Halma.AI.Base.Rating instance GHC.Enum.Bounded Game.Halma.AI.Base.Rating module Game.Halma.AI.Competitive aiMove :: RuleOptions -> HalmaBoard -> Perspective -> Move module Game.Halma.AI.Ignorant aiMove :: RuleOptions -> HalmaBoard -> Team -> Move