Class GtpParser
- Namespace
- WeiqiSharp.Core
- Assembly
- WeiqiSharp.Core.dll
A set of functions for handling and generating Go Text Protocol strings.
public static class GtpParser
- Inheritance
-
GtpParser
- Inherited Members
Methods
ToGtp(Move, bool)
Encodes a move into GTP for output to another program.
Can be either a GTP input (e.g. play black Q7) or an output (e.g. G18).
public static string ToGtp(Move move, bool input = false)
Parameters
moveMoveThe move which will be encoded.
inputboolWhich format, either a GTP input or output, the encoding is in.
Returns
- string
The encoded string.
Exceptions
- Exception
If passed an Empty Move.
- ArgumentOutOfRangeException
If passed an invalid SpaceState
TryParseMove(string, out Move?)
Attempts to parse a GTP input string (e.g. play white B12).
public static bool TryParseMove(string moveText, out Move? move)
Parameters
moveTextstringThe GTP string
moveMove?The target variable for the Move. NotNullWhenAttribute when return is true.
Returns
- bool
Whether the parsing was successful
TryParseMove(string, SpaceState, out Move?)
Attempts to parse a GTP output string (e.g. G5). Accepts a SpaceState to give to the move.
public static bool TryParseMove(string moveText, SpaceState color, out Move? move)
Parameters
moveTextstringThe GTP string
colorSpaceStateThe SpaceState which the Move will get.
moveMove?The output variable for the Move. NotNullWhenAttribute when return is true.
Returns
- bool
Whether the parsing was successful