Class GameBoard
Represents the chess game.
Inheritance
Inherited Members
Namespace: ChessSharp
Assembly: ChessSharp.dll
Syntax
public class GameBoard
Constructors
| Improve this Doc View SourceGameBoard()
Initializes a new instance of GameBoard.
Declaration
public GameBoard()
Properties
| Improve this Doc View SourceBoard
Gets a 2D array of Pieces in the board.
Declaration
public Piece[, ] Board { get; }
Property Value
Type | Description |
---|---|
Piece[,] |
GameState
Gets the current GameState.
Declaration
public GameState GameState { get; }
Property Value
Type | Description |
---|---|
GameState |
Item[File, Rank]
Gets Piece in a specific square.
Declaration
public Piece this[File file, Rank rank] { get; }
Parameters
Type | Name | Description |
---|---|---|
File | file | The File of the square. |
Rank | rank | The Rank of the square. |
Property Value
Type | Description |
---|---|
Piece |
Item[Square]
Gets Piece in a specific square.
Declaration
public Piece this[Square square] { get; }
Parameters
Type | Name | Description |
---|---|---|
Square | square |
Property Value
Type | Description |
---|---|
Piece |
Moves
Gets a list of the game moves.
Declaration
public List<Move> Moves { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<Move> |
Methods
| Improve this Doc View SourceIsValidMove(Move)
Checks if a given move is valid or not.
Declaration
public bool IsValidMove(Move move)
Parameters
Type | Name | Description |
---|---|---|
Move | move | The Move to check its validity. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the given |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The given |
MakeMove(Move, Boolean)
Makes a move in the game.
Declaration
public bool MakeMove(Move move, bool isMoveValidated)
Parameters
Type | Name | Description |
---|---|---|
Move | move | The Move you want to make. |
System.Boolean | isMoveValidated | Only pass true when you've already checked that the move is valid. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the move is made; false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The |
System.InvalidOperationException | The Source square of the |
System.ArgumentNullException | The |
WhoseTurn()
Gets the Player who has turn.
Declaration
public Player WhoseTurn()
Returns
Type | Description |
---|---|
Player |