Safe Haskell | None |
---|---|
Language | Haskell98 |
Data structures that wrap and provide a higher-level interface to the SGF game tree, including a zipper that navigates the tree and provides the current board state.
- data RootInfo = RootInfo {}
- data GameInfo = GameInfo {
- gameInfoRootInfo :: RootInfo
- gameInfoBlackName :: Maybe SimpleText
- gameInfoBlackTeamName :: Maybe SimpleText
- gameInfoBlackRank :: Maybe SimpleText
- gameInfoWhiteName :: Maybe SimpleText
- gameInfoWhiteTeamName :: Maybe SimpleText
- gameInfoWhiteRank :: Maybe SimpleText
- gameInfoRuleset :: Maybe Ruleset
- gameInfoBasicTimeSeconds :: Maybe RealValue
- gameInfoOvertime :: Maybe SimpleText
- gameInfoResult :: Maybe GameResult
- gameInfoGameName :: Maybe SimpleText
- gameInfoGameComment :: Maybe Text
- gameInfoOpeningComment :: Maybe SimpleText
- gameInfoEvent :: Maybe SimpleText
- gameInfoRound :: Maybe SimpleText
- gameInfoPlace :: Maybe SimpleText
- gameInfoDatesPlayed :: Maybe SimpleText
- gameInfoSource :: Maybe SimpleText
- gameInfoCopyright :: Maybe SimpleText
- gameInfoAnnotatorName :: Maybe SimpleText
- gameInfoEntererName :: Maybe SimpleText
- emptyGameInfo :: RootInfo -> GameInfo
- internalIsGameInfoNode :: Node -> Bool
- gameInfoToProperties :: GameInfo -> [Property]
- data BoardState = BoardState {
- boardCoordStates :: [[CoordState]]
- boardHasInvisible :: Bool
- boardHasDimmed :: Bool
- boardHasCoordMarks :: Bool
- boardArrows :: ArrowList
- boardLines :: LineList
- boardLabels :: LabelList
- boardMoveNumber :: Integer
- boardPlayerTurn :: Color
- boardBlackCaptures :: Int
- boardWhiteCaptures :: Int
- boardGameInfo :: GameInfo
- boardWidth :: BoardState -> Int
- boardHeight :: BoardState -> Int
- data CoordState = CoordState {
- coordStar :: Bool
- coordStone :: Maybe Color
- coordMark :: Maybe Mark
- coordVisible :: Bool
- coordDimmed :: Bool
- emptyBoardState :: Int -> Int -> BoardState
- rootBoardState :: Node -> BoardState
- emptyCoordState :: CoordState
- boardCoordState :: Coord -> BoardState -> CoordState
- boardCoordModify :: BoardState -> Coord -> (CoordState -> CoordState) -> BoardState
- mapBoardCoords :: (Int -> Int -> CoordState -> a) -> BoardState -> [[a]]
- isValidMove :: BoardState -> Color -> Coord -> Bool
- isCurrentValidMove :: BoardState -> Coord -> Bool
- data Cursor
- cursorParent :: Cursor -> Maybe Cursor
- cursorChildIndex :: Cursor -> Int
- cursorNode :: Cursor -> Node
- cursorBoard :: Cursor -> BoardState
- rootCursor :: Node -> Cursor
- cursorRoot :: Cursor -> Cursor
- cursorChild :: Cursor -> Int -> Cursor
- cursorChildren :: Cursor -> [Cursor]
- cursorChildCount :: Cursor -> Int
- cursorChildPlayingAt :: Maybe Coord -> Cursor -> Maybe Cursor
- cursorProperties :: Cursor -> [Property]
- cursorModifyNode :: (Node -> Node) -> Cursor -> Cursor
- cursorVariations :: VariationModeSource -> Cursor -> [(Coord, Color)]
- moveToProperty :: Color -> Maybe Coord -> Property
Documentation
Properties that are specified in the root nodes of game trees.
Properties that are specified in game info nodes.
emptyGameInfo :: RootInfo -> GameInfo Source #
internalIsGameInfoNode :: Node -> Bool Source #
Returns whether a node contains any game info properties.
gameInfoToProperties :: GameInfo -> [Property] Source #
data BoardState Source #
An object that corresponds to a node in some game tree, and represents the state of the game at that node, including board position, player turn and captures, and also board annotations.
BoardState | |
|
boardWidth :: BoardState -> Int Source #
Returns the width of the board, in stones.
boardHeight :: BoardState -> Int Source #
Returns the height of the board, in stones.
data CoordState Source #
Used by BoardState
to represent the state of a single point on the board.
Records whether a stone is present, as well as annotations and visibility
properties.
CoordState | |
|
emptyBoardState :: Int -> Int -> BoardState Source #
Creates a BoardState
for an empty board of the given width and height.
rootBoardState :: Node -> BoardState Source #
emptyCoordState :: CoordState Source #
A CoordState
for an empty point on the board.
boardCoordState :: Coord -> BoardState -> CoordState Source #
Returns the CoordState
for a coordinate on a board.
boardCoordModify :: BoardState -> Coord -> (CoordState -> CoordState) -> BoardState Source #
Modifies a BoardState
by updating the CoordState
at a single point.
mapBoardCoords :: (Int -> Int -> CoordState -> a) -> BoardState -> [[a]] Source #
Maps a function over each CoordState
in a BoardState
, returning a
list-of-lists with the function's values. The function is called like fn y
x coordState
.
isValidMove :: BoardState -> Color -> Coord -> Bool Source #
Returns whether it is legal to place a stone of the given color at a point on a board. Accepts out-of-bound coordinates and returns false.
isCurrentValidMove :: BoardState -> Coord -> Bool Source #
Returns whether it is legal for the current player to place a stone at a point on a board. Accepts out-of-bound coordinates and returns false.
A pointer to a node in a game tree that also holds information about the current state of the game at that node.
cursorParent :: Cursor -> Maybe Cursor Source #
The cursor for the node above this cursor's node in the game tree. The node of the parent cursor is the parent of the cursor's node.
This is Nothing
iff the cursor's node has no parent.
cursorChildIndex :: Cursor -> Int Source #
The index of this cursor's node in its parent's child list. When the cursor's node has no parent, the value in this field is not specified.
cursorNode :: Cursor -> Node Source #
The game tree node about which the cursor stores information.
cursorBoard :: Cursor -> BoardState Source #
The complete board state for the current node.
rootCursor :: Node -> Cursor Source #
Returns a cursor for a root node.
cursorRoot :: Cursor -> Cursor Source #
cursorChildren :: Cursor -> [Cursor] Source #
cursorChildCount :: Cursor -> Int Source #
cursorProperties :: Cursor -> [Property] Source #
This is simply
.nodeProperties
. cursorNode
cursorVariations :: VariationModeSource -> Cursor -> [(Coord, Color)] Source #