C# Class ChessDotNet.ChessGame

显示文件 Open project: ProgramFOX/Chess.NET Class Usage Examples

Protected Properties

Property Type Description
Board ChessDotNet.Piece[][]
checkmatedCacheBlack Cache
checkmatedCacheWhite Cache
fiftyMoves bool
inCheckCacheBlack Cache
inCheckCacheWhite Cache
stalematedCacheBlack Cache
stalematedCacheWhite Cache

Public Methods

Method Description
ApplyMove ( Move move, bool alreadyValidated ) : MoveType
ChessGame ( ) : System
ChessGame ( GameCreationData data ) : System
ChessGame ( IEnumerable moves, bool movesAreValidated ) : System
ChessGame ( string fen ) : System
ClaimDraw ( string reason ) : void
GetBoard ( ) : ChessDotNet.Piece[][]
GetFen ( ) : string
GetPieceAt ( File file, int rank ) : Piece
GetPieceAt ( Position position ) : Piece
GetValidMoves ( Player player ) : ReadOnlyCollection
GetValidMoves ( Position from ) : ReadOnlyCollection
HasAnyValidMoves ( Player player ) : bool
HasAnyValidMoves ( Position from ) : bool
IsCheckmated ( Player player ) : bool
IsDraw ( ) : bool
IsInCheck ( Player player ) : bool
IsStalemated ( Player player ) : bool
IsValidMove ( Move move ) : bool
IsWinner ( Player player ) : bool
MapPgnCharToPiece ( char c, Player owner ) : Piece
Resign ( Player player ) : void
WouldBeInCheckAfter ( Move move, Player player ) : bool

Protected Methods

Method Description
ApplyCastle ( Move move ) : CastlingType
CloneBoard ( Piece originalBoard ) : ChessDotNet.Piece[][]
FenStringToGameCreationData ( string fen ) : GameCreationData
GetValidMoves ( Player player, bool returnIfAny ) : ReadOnlyCollection
GetValidMoves ( Position from, bool returnIfAny ) : ReadOnlyCollection
IsValidMove ( Move move, bool validateCheck ) : bool
IsValidMove ( Move move, bool validateCheck, bool careAboutWhoseTurnItIs ) : bool
SetPieceAt ( File file, int rank, Piece piece ) : void
UseGameCreationData ( GameCreationData data ) : void

Private Methods

Method Description
ChessGame ( Piece board, Player whoseTurn ) : System

Method Details

ApplyCastle() protected method

protected ApplyCastle ( Move move ) : CastlingType
move Move
return CastlingType

ApplyMove() public method

public ApplyMove ( Move move, bool alreadyValidated ) : MoveType
move Move
alreadyValidated bool
return MoveType

ChessGame() public method

public ChessGame ( ) : System
return System

ChessGame() public method

public ChessGame ( GameCreationData data ) : System
data GameCreationData
return System

ChessGame() public method

public ChessGame ( IEnumerable moves, bool movesAreValidated ) : System
moves IEnumerable
movesAreValidated bool
return System

ChessGame() public method

public ChessGame ( string fen ) : System
fen string
return System

ClaimDraw() public method

public ClaimDraw ( string reason ) : void
reason string
return void

CloneBoard() protected static method

protected static CloneBoard ( Piece originalBoard ) : ChessDotNet.Piece[][]
originalBoard Piece
return ChessDotNet.Piece[][]

FenStringToGameCreationData() protected method

protected FenStringToGameCreationData ( string fen ) : GameCreationData
fen string
return GameCreationData

GetBoard() public method

public GetBoard ( ) : ChessDotNet.Piece[][]
return ChessDotNet.Piece[][]

GetFen() public method

public GetFen ( ) : string
return string

GetPieceAt() public method

public GetPieceAt ( File file, int rank ) : Piece
file File
rank int
return Piece

GetPieceAt() public method

public GetPieceAt ( Position position ) : Piece
position Position
return Piece

GetValidMoves() public method

public GetValidMoves ( Player player ) : ReadOnlyCollection
player Player
return ReadOnlyCollection

GetValidMoves() protected method

protected GetValidMoves ( Player player, bool returnIfAny ) : ReadOnlyCollection
player Player
returnIfAny bool
return ReadOnlyCollection

GetValidMoves() public method

public GetValidMoves ( Position from ) : ReadOnlyCollection
from Position
return ReadOnlyCollection

GetValidMoves() protected method

protected GetValidMoves ( Position from, bool returnIfAny ) : ReadOnlyCollection
from Position
returnIfAny bool
return ReadOnlyCollection

HasAnyValidMoves() public method

public HasAnyValidMoves ( Player player ) : bool
player Player
return bool

HasAnyValidMoves() public method

public HasAnyValidMoves ( Position from ) : bool
from Position
return bool

IsCheckmated() public method

public IsCheckmated ( Player player ) : bool
player Player
return bool

IsDraw() public method

public IsDraw ( ) : bool
return bool

IsInCheck() public method

public IsInCheck ( Player player ) : bool
player Player
return bool

IsStalemated() public method

public IsStalemated ( Player player ) : bool
player Player
return bool

IsValidMove() public method

public IsValidMove ( Move move ) : bool
move Move
return bool

IsValidMove() protected method

protected IsValidMove ( Move move, bool validateCheck ) : bool
move Move
validateCheck bool
return bool

IsValidMove() protected method

protected IsValidMove ( Move move, bool validateCheck, bool careAboutWhoseTurnItIs ) : bool
move Move
validateCheck bool
careAboutWhoseTurnItIs bool
return bool

IsWinner() public method

public IsWinner ( Player player ) : bool
player Player
return bool

MapPgnCharToPiece() public method

public MapPgnCharToPiece ( char c, Player owner ) : Piece
c char
owner Player
return Piece

Resign() public method

public Resign ( Player player ) : void
player Player
return void

SetPieceAt() protected method

protected SetPieceAt ( File file, int rank, Piece piece ) : void
file File
rank int
piece Piece
return void

UseGameCreationData() protected method

protected UseGameCreationData ( GameCreationData data ) : void
data GameCreationData
return void

WouldBeInCheckAfter() public method

public WouldBeInCheckAfter ( Move move, Player player ) : bool
move Move
player Player
return bool

Property Details

Board protected_oe property

protected Piece[][],ChessDotNet Board
return ChessDotNet.Piece[][]

checkmatedCacheBlack protected_oe property

protected Cache checkmatedCacheBlack
return Cache

checkmatedCacheWhite protected_oe property

protected Cache checkmatedCacheWhite
return Cache

fiftyMoves protected_oe property

protected bool fiftyMoves
return bool

inCheckCacheBlack protected_oe property

protected Cache inCheckCacheBlack
return Cache

inCheckCacheWhite protected_oe property

protected Cache inCheckCacheWhite
return Cache

stalematedCacheBlack protected_oe property

protected Cache stalematedCacheBlack
return Cache

stalematedCacheWhite protected_oe property

protected Cache stalematedCacheWhite
return Cache