Safe Haskell | None |
---|
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 {}
- boardWidth :: BoardState -> Int
- boardHeight :: BoardState -> Int
- data CoordState = CoordState {
- coordStar :: Bool
- coordStone :: Maybe Color
- coordMark :: Maybe Mark
- coordVisible :: Bool
- coordDimmed :: Bool
- rootBoardState :: Node -> BoardState
- boardCoordState :: Coord -> BoardState -> CoordState
- mapBoardCoords :: (Int -> Int -> CoordState -> a) -> BoardState -> [[a]]
- isValidMove :: BoardState -> Color -> Coord -> Bool
- isCurrentValidMove :: BoardState -> Coord -> Bool
- data Cursor = Cursor {}
- 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.
internalIsGameInfoNode :: Node -> BoolSource
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 -> IntSource
Returns the width of the board, in stones.
boardHeight :: BoardState -> IntSource
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 | |
|
boardCoordState :: Coord -> BoardState -> CoordStateSource
Returns the CoordState
for a coordinate on a board.
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 -> BoolSource
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 -> BoolSource
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.
Cursor | |
|
rootCursor :: Node -> CursorSource
Returns a cursor for a root node.
cursorRoot :: Cursor -> CursorSource
cursorChild :: Cursor -> Int -> CursorSource
cursorChildren :: Cursor -> [Cursor]Source
cursorChildCount :: Cursor -> IntSource
cursorProperties :: Cursor -> [Property]Source
This is simply
.
nodeProperties
. cursorNode
cursorVariations :: VariationModeSource -> Cursor -> [(Coord, Color)]Source
Returns the variations to display for a cursor. The returned list contains
the location and color of B
and W
properties in variation nodes.
Variation nodes are either children of the current node, or siblings of the
current node, depending on the variation mode source.
moveToProperty :: Color -> Maybe Coord -> PropertySource