• Home
  • API documentation
Show / Hide Table of Contents
  • ChessSharp
    • ChessUtilities
    • GameBoard
    • GameState
    • Move
    • Piece
    • Player
  • ChessSharp.Pieces
    • Bishop
    • King
    • Knight
    • Pawn
    • PawnPromotion
    • Queen
    • Rook
  • ChessSharp.SquareData
    • File
    • Rank
    • Square

Class GameBoard

Represents the chess game.

Inheritance
System.Object
GameBoard
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ChessSharp
Assembly: ChessSharp.dll
Syntax
public class GameBoard

Constructors

| Improve this Doc View Source

GameBoard()

Initializes a new instance of GameBoard.

Declaration
public GameBoard()

Properties

| Improve this Doc View Source

Board

Gets a 2D array of Pieces in the board.

Declaration
public Piece[, ] Board { get; }
Property Value
Type Description
Piece[,]
| Improve this Doc View Source

GameState

Gets the current GameState.

Declaration
public GameState GameState { get; }
Property Value
Type Description
GameState
| Improve this Doc View Source

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
| Improve this Doc View Source

Item[Square]

Gets Piece in a specific square.

Declaration
public Piece this[Square square] { get; }
Parameters
Type Name Description
Square square

The Square to get its Piece.

Property Value
Type Description
Piece
| Improve this Doc View Source

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 Source

IsValidMove(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 move is valid; false otherwise.

Exceptions
Type Condition
System.ArgumentNullException

The given move is null.

| Improve this Doc View Source

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 move is null.

System.InvalidOperationException

The Source square of the move doesn't contain a piece.

System.ArgumentNullException

The move.PromoteTo is null and the move is a pawn promotion move.

| Improve this Doc View Source

WhoseTurn()

Gets the Player who has turn.

Declaration
public Player WhoseTurn()
Returns
Type Description
Player
  • Improve this Doc
  • View Source
Back to top Generated by DocFX