Class: Games_Chess
Source Location: /Games_Chess-0.7.0/Chess.php
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
addPiece [line 755]
void addPiece(
W|B
$color, P|N|K|Q|R|B
$type, string
$square)
|
|
Add a piece to the chessboard Must be overridden in child classes
Overridden in child classes as:
- Games_Chess_Standard::addPiece()
- Add a piece to the chessboard
Parameters:
blankBoard [line 335]
canCastleKingside [line 805]
boolean canCastleKingside(
)
|
|
Determine legality of kingside castling
canCastleQueenside [line 815]
boolean canCastleQueenside(
)
|
|
Determine legality of queenside castling
commitTransaction [line 2225]
void commitTransaction(
)
|
|
Remove any possibility of undo.
gameOver [line 481]
getDiagonalColor [line 2023]
void getDiagonalColor(
$square)
|
|
Parameters:
getMessage [line 2084]
string getMessage(
integer
$code, array
$extra)
|
|
Get an error message from the code Future versions of this method will be multi-language
Parameters:
getMoveList [line 473]
Get the list of moves in Standard Algebraic Notation Can be used to populate a PGN file.
getPieceLocations [line 1673]
array|PEAR_Error getPieceLocations(
[W|B
$color = null])
|
|
Get the location of all pieces on the board of a certain color Default is the color that is about to move
Parameters:
getPossibleBishopMoves [line 1729]
array getPossibleBishopMoves(
string
$square, [W|B
$color = null])
|
|
Get all legal Bishop moves (checking of the king is not taken into account)
Parameters:
getPossibleKingMoves [line 1979]
array getPossibleKingMoves(
string
$square, [W|B
$color = null], [
$returnCastleMoves = true])
|
|
Get all legal King moves (checking of the king is not taken into account)
Parameters:
getPossibleKnightMoves [line 1704]
array getPossibleKnightMoves(
string
$square, [W|B
$color = null])
|
|
Get all legal Knight moves (checking of the king is not taken into account)
Parameters:
getPossibleMoves [line 1328]
array|PEAR_Error getPossibleMoves(
K|P|Q|R|B|N
$piece, string
$square, [B|W
$color = null], [boolean
$returnCastleMoves = true])
|
|
Get a list of all possible theoretical squares a piece of this nature and color could move to with the current board and game setup. This method will return all valid moves without determining the presence of check
Parameters:
getPossiblePawnMoves [line 1898]
array getPossiblePawnMoves(
string
$square, [W|B
$color = null], [
$enpassant = null])
|
|
Get all legal Pawn moves (checking of the king is not taken into account)
Parameters:
getPossibleQueenMoves [line 1879]
array getPossibleQueenMoves(
string
$square, [W|B
$color = null])
|
|
Get all legal Queen moves (checking of the king is not taken into account)
Parameters:
getPossibleRookMoves [line 1804]
array getPossibleRookMoves(
string
$square, [W|B
$color = null])
|
|
Get all legal Rook moves (checking of the king is not taken into account)
Parameters:
in50MoveDraw [line 621]
Determine whether any pawn move or capture has occurred in the past 50 moves
inBasicDraw [line 641]
Determine the presence of a basic draw as defined by FIDE rules The rule states: 10.4
The game is drawn when one of the following endings arises:
(a) king against king;
(b) king against king with only bishop or knight;
(c) king and bishop against king and bishop, with both bishops
on diagonals of the same colour.
inCheckMate [line 499]
boolean inCheckMate(
[W|B
$color = null])
|
|
Determine whether a side is in checkmate
Parameters:
inDraw [line 577]
boolean inDraw(
[W|B
$color = null])
|
|
Determines the presence of a forced draw
Parameters:
inRepetitionDraw [line 608]
boolean inRepetitionDraw(
)
|
|
Determine whether draw by repetition has happened From FIDE rules: 10.10
The game is drawn, upon a claim by the player having the move, when the
same position, for the third time:
(a) is about to appear, if he first writes the move on his
scoresheet and declares to the arbiter his intention of making
this move; or
(b) has just appeared, the same player having the move each time.
The position is considered the same if pieces of the same kind and
colour occupy the same squares, and if all the possible moves of
all the pieces are the same, including the rights to castle [at
some future time] or to capture a pawn "en passant".This class determines draw by comparing FENs rendered after every move
inStaleMate [line 541]
boolean inStaleMate(
[W|B
$color = null])
|
|
Determine whether a side is in stalemate
Parameters:
isError [line 2201]
boolean isError(
mixed
$err)
|
|
Determines whether the data returned from a method is a PEAR-related error class
Parameters:
isPromoteMove [line 781]
boolean isPromoteMove(
string
$from, string
$to)
|
|
Determine whether moving a piece from one square to another requires a pawn promotion
Parameters:
moveSAN [line 371]
true|PEAR_Error moveSAN(
string
$move)
|
|
Make a move from a Standard Algebraic Notation (SAN) format SAN is just a normal chess move like Na4, instead of the English Notation, like NR4
Parameters:
moveSquare [line 457]
true|PEAR_Error moveSquare(
string
$from, string
$to, [string
$promote = ''])
|
|
Move a piece from one square to another, and mark the old square as empty
Parameters:
raiseError [line 2069]
PEAR_Error raiseError(
integer
$code, [array
$extra = array()])
|
|
Parameters:
renderFen [line 704]
string renderFen(
[boolean
$include_moves = true])
|
|
render the FEN notation for the current board
Parameters:
resetGame [line 352]
PEAR_Error|true resetGame(
[false|string
$fen = false])
|
|
Create a new game with the starting position, or from the position specified by $fen
Parameters:
rollbackTransaction [line 2233]
void rollbackTransaction(
)
|
|
Undo any changes to state since startTransaction() was first used
startTransaction [line 2212]
Begin a chess piece transaction Transactions are used to attempt moves that may be revoked later, especially in methods like inCheckMate()
toArray [line 768]
Generate a representation of the chess board and pieces for use as a direct translation to a visual chess board Must be overridden in child classes
Overridden in child classes as:
- Games_Chess_Standard::toArray()
- Generate a representation of the chess board and pieces for use as a
toMove [line 796]
_convertSquareToSAN [line 1223]
string|PEAR_Error _convertSquareToSAN(
string
$from, string
$to, [string
$promote = ''])
|
|
Convert a starting and ending algebraic square into SAN
Parameters:
_getAllPieceLocations [line 1693]
array _getAllPieceLocations(
W|B
$color)
|
|
Get the location of every piece on the board of color $color
Overridden in child classes as:
- Games_Chess_Standard::_getAllPieceLocations()
- Get the location of every piece on the board of color $color
Parameters:
_getCastleSquares [line 1605]
array _getCastleSquares(
string
$square)
|
|
Get a list of all the squares a king could castle to on an empty board WARNING: assumes valid input
Parameters:
_getDiagonalColor [line 2013]
B|W _getDiagonalColor(
string
$square)
|
|
Return the color of a square (black or white)
Parameters:
_getKingSquares [line 1635]
array _getKingSquares(
string
$square)
|
|
Get a list of all the squares a king could move to on an empty board WARNING: assumes valid input
Parameters:
_getKnightSquares [line 1555]
array _getKnightSquares(
string
$square, [boolean
$returnFlatArray = false])
|
|
Get all the squares a knight could move to on an empty board WARNING: assumes valid input
Parameters:
_getQueenSquares [line 1536]
array _getQueenSquares(
string
$square, [boolean
$returnFlatArray = false])
|
|
Get all the squares a queen could go to on a blank board WARNING: assumes valid input
Parameters:
_getRookSquares [line 1470]
array _getRookSquares(
string
$square, [boolean
$returnFlatArray = false])
|
|
Get the set of squares that are diagonals from this square on an empty board. WARNING: assumes valid input
Parameters:
_moveAlgebraic [line 830]
void _moveAlgebraic(
string
$from, string
$to, [string
$promote = ''])
|
|
Move a piece from one square to another, and mark the old square as empty NO validation is performed, use moveSquare() for validation.
Parameters:
_parseMove [line 854]
array _parseMove(
string
$move)
|
|
Parse out the segments of a move (minus any annotations)
Parameters:
_setupStartingPosition [line 915]
void _setupStartingPosition(
)
|
|
Set up the board with the starting position Must be overridden in child classes
Overridden in child classes as:
- Games_Chess_Standard::_setupStartingPosition()
- Set up a starting position for a new chess game
_validMove [line 1101]
Documentation generated on Mon, 11 Mar 2019 10:14:58 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|