Chess Game  1.1.0
A full chess game for Unity
cgNotation Class Reference

Reads / writes game notation. Supports algebraic and coordinate notations. More...

Public Types

enum  NotationType { Algebraic, Coordinate }
 Notationtypes, algrebraic = e4, bxd3, O-O etc. Coordinate: e2-e4 d1-c2 c3-h8 etc. More...
 
enum  FormatType { None, PGN }
 PGN format is the standard of chess. More...
 

Public Member Functions

 cgNotation (cgBoard fromBoard)
 Notates the a game from the provided board. More...
 
void AddMove (cgSimpleMove move)
 Add a move to the list of moves. More...
 
void AddMove (string move, NotationType notationType)
 Add a move based on a notation type. More...
 
string writeFullNotation (NotationType type, FormatType formatType=FormatType.None)
 Writes the full game notation from the current moves stored in Moves list. More...
 
string getLogFriendlyNotation ()
 A slight adjustment to GetFullNotation, in which new lines are added to indent the text in an orderly fashion to be displayed to the player. More...
 
void Read (string curgame)
 Read the notations in the provided string. More...
 

Public Attributes

List< cgSimpleMovemoves = new List<cgSimpleMove>()
 All moves being notated More...
 
cgBoard board
 

Detailed Description

Reads / writes game notation. Supports algebraic and coordinate notations.

Member Enumeration Documentation

◆ FormatType

enum cgNotation.FormatType
strong

PGN format is the standard of chess.

◆ NotationType

Notationtypes, algrebraic = e4, bxd3, O-O etc. Coordinate: e2-e4 d1-c2 c3-h8 etc.

Constructor & Destructor Documentation

◆ cgNotation()

cgNotation.cgNotation ( cgBoard  fromBoard)

Notates the a game from the provided board.

Parameters
fromBoardThe board containing all moves to be notated

Member Function Documentation

◆ AddMove() [1/2]

void cgNotation.AddMove ( cgSimpleMove  move)

Add a move to the list of moves.

Parameters
move

◆ AddMove() [2/2]

void cgNotation.AddMove ( string  move,
NotationType  notationType 
)

Add a move based on a notation type.

Parameters
movethe string representation of the move(e4, bxd3 or e2-e4 etc.)
notationType

◆ getLogFriendlyNotation()

string cgNotation.getLogFriendlyNotation ( )

A slight adjustment to GetFullNotation, in which new lines are added to indent the text in an orderly fashion to be displayed to the player.

Returns

◆ Read()

void cgNotation.Read ( string  curgame)

Read the notations in the provided string.

Parameters
curgamethe string to decipher.

◆ writeFullNotation()

string cgNotation.writeFullNotation ( NotationType  type,
FormatType  formatType = FormatType.None 
)

Writes the full game notation from the current moves stored in Moves list.

Parameters
typeWhat notationtype should it be?
formatTypeShould it be PGN format or not?
Returns
A string with full game notation.

Member Data Documentation

◆ moves

List<cgSimpleMove> cgNotation.moves = new List<cgSimpleMove>()

All moves being notated


The documentation for this class was generated from the following file: