Safe Haskell | Safe-Inferred |
---|
Constants and data types for property values used in SGF game trees.
- supportedFormatVersions :: [Int]
- defaultFormatVersion :: Int
- supportedGameTypes :: [Int]
- boardSizeDefault :: Int
- boardSizeMin :: Int
- boardSizeMax :: Int
- type Coord = (Int, Int)
- data CoordList
- coordListSingles :: CoordList -> [Coord]
- coordListRects :: CoordList -> [(Coord, Coord)]
- coord1 :: Coord -> CoordList
- coords :: [Coord] -> CoordList
- coords' :: [Coord] -> [(Coord, Coord)] -> CoordList
- emptyCoordList :: CoordList
- expandCoordList :: CoordList -> [Coord]
- buildCoordList :: [Coord] -> CoordList
- type RealValue = Rational
- class Stringlike a where
- sgfToString :: a -> String
- stringToSgf :: String -> a
- data Text
- fromText :: Text -> String
- toText :: String -> Text
- data SimpleText
- fromSimpleText :: SimpleText -> String
- toSimpleText :: String -> SimpleText
- data UnknownPropertyValue
- fromUnknownPropertyValue :: UnknownPropertyValue -> String
- toUnknownPropertyValue :: String -> UnknownPropertyValue
- data DoubleValue
- data Color
- cnot :: Color -> Color
- data VariationMode = VariationMode {}
- data VariationModeSource
- defaultVariationMode :: VariationMode
- toVariationMode :: Int -> Maybe VariationMode
- fromVariationMode :: VariationMode -> Int
- type ArrowList = [(Coord, Coord)]
- type LineList = [(Coord, Coord)]
- type LabelList = [(Coord, SimpleText)]
- data Mark
- = MarkCircle
- | MarkSquare
- | MarkTriangle
- | MarkX
- | MarkSelected
- data GameResult
- data WinReason
- data Ruleset
- data RulesetType
- fromRuleset :: Ruleset -> String
- toRuleset :: String -> Ruleset
Documentation
defaultFormatVersion :: IntSource
The default SGF version to use when FF[]
is not specified in a root node.
This value is actually INCORRECT: SGF defines it to be 1, but because we don't support version 1 yet, for the sake of ignoring this issue (for now!) in tests, we fix the default to be 4.
TODO Fix the default version to be 1 as SGF mandates.
The default size of the board. The FF[4] SGF spec says that the default Go board is 19x19 square.
The minimum board size allowed by FF[4], 1.
The maximum board size allowed by FF[4], 52.
A coordinate on a Go board. (0, 0)
refers to the upper-left corner of
the board. The first component is the horizontal position; the second
component is the vertical position.
A structure for compact representation of a list of coordinates. Contains
a list of individual points, as well as a list of rectangles of points
denoted by an ordered pair of the upper-left point and the lower-right point.
The union of the single points and points contained within rectangles make up
all of the points a CoordList
represents. There is no rule saying that
adjacent points have to be grouped into rectangles; it's perfectly valid
(although possibly inefficient) to never use rectangles.
For any CoordList
, all of the following hold:
- Any point may be specified at most once, either in the singles list or in a single rectangle.
- For a rectangle
((x0,y0), (x1,y1))
,x0 <= x1
andy0 <= y1
and(x0,y0) /= (x1,y1)
(otherwise the point belongs in the singles list).
coordListSingles :: CoordList -> [Coord]Source
Returns the single points in a CoordList
.
coords :: [Coord] -> CoordListSource
Constructs a CoordList
containing the given single points. For rectangle
detection, use buildCoordList
.
coords' :: [Coord] -> [(Coord, Coord)] -> CoordListSource
Constructs a CoordList
containing the given single points and rectangles.
emptyCoordList :: CoordListSource
A CoordList
that contains no points.
expandCoordList :: CoordList -> [Coord]Source
Converts a compact CoordList
to a list of coordinates.
buildCoordList :: [Coord] -> CoordListSource
class Stringlike a whereSource
A class for SGF data types that are coercable to and from strings.
The construction of an SGF value with stringToSgf
may process the input,
such that the resulting stringlike value does not represent the same string
as the input. In other words, the following does *not* necessarily hold:
sgfToString . stringToSgf = id (does not necessarily hold!)
The following does hold, however:
stringToSgf . sgfToString = id
sgfToString :: a -> StringSource
Extracts the string value from an SGF value.
stringToSgf :: String -> aSource
Creates an SGF value from a string value.
fromSimpleText :: SimpleText -> StringSource
Converts an SGF SimpleText
to a string.
toSimpleText :: String -> SimpleTextSource
Converts a string to an SGF SimpleText
, replacing all whitespaces
(including newlines) with spaces.
data UnknownPropertyValue Source
The value type for an UnknownProperty
. Currently represented as a
string.
fromUnknownPropertyValue :: UnknownPropertyValue -> StringSource
Returns the string contained within the UnknownProperty
this value is
from.
toUnknownPropertyValue :: String -> UnknownPropertyValueSource
Constructs a value for a UnknownProperty
.
data DoubleValue Source
An SGF double value: either 1 or 2, nothing else.
Returns the logical negation of a stone color, yang for yin and yin for yang.
data VariationMode Source
SGF flags that control how move variations are to be presented while displaying the game.
VariationMode | |
|
data VariationModeSource Source
An enumeration that describes which variations are shown.
ShowChildVariations | Show children of the current move. |
ShowCurrentVariations | Show alternatives to the current move. |
defaultVariationMode :: VariationModeSource
The default variation mode as defined by the SGF spec is VariationMode
ShowChildVariations True
.
toVariationMode :: Int -> Maybe VariationModeSource
Parses a numeric variation mode, returning nothing if the number is invalid.
fromVariationMode :: VariationMode -> IntSource
Returns the integer value for a variation mode.
type LabelList = [(Coord, SimpleText)]Source
A list of labels, each specified with a string and a coordinate about which to center the string.
The markings that SGF supports annotating coordinates with.
data GameResult Source
A ruleset used for a Go game. Can be one of the rulesets defined by the SGF specification, or a custom string.
data RulesetType Source
The rulesets defined by the SGF specification, for use with Ruleset
.
fromRuleset :: Ruleset -> StringSource
Returns the string representation for a ruleset.