Class: Games_Chess
Source Location: /Games_Chess-0.9.0/Chess.php
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
addPiece [line 809]
blankBoard [line 376]
canCastleKingside [line 859]
boolean canCastleKingside(
)
|
|
Determine legality of kingside castling
canCastleQueenside [line 869]
boolean canCastleQueenside(
)
|
|
Determine legality of queenside castling
commitTransaction [line 2325]
void commitTransaction(
)
|
|
Remove any possibility of undo.
factory [line 358]
void &factory(
[
$type = 'Standard'])
|
|
Parameters:
gameOver [line 535]
getDiagonalColor [line 2093]
void getDiagonalColor(
$square)
|
|
Parameters:
getMessage [line 2154]
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 524]
array getMoveList(
[boolean
$withChecks = false])
|
|
Get the list of moves in Standard Algebraic Notation Can be used to populate a PGN file.
Parameters:
getPieceLocations [line 1743]
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 1799]
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 2049]
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 1774]
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 1398]
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 1968]
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 1949]
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 1874]
array getPossibleRookMoves(
string
$square, [W|B
$color = null])
|
|
Get all legal Rook moves (checking of the king is not taken into account)
Parameters:
getState [line 2317]
Get the current state of the chess game Use this in conjunction with setState
Parameters:
in50MoveDraw [line 675]
inBasicDraw [line 695]
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.
Overridden in child classes as:
- Games_Chess_Crazyhouse::inBasicDraw()
- Basic draw is impossible in crazyhouse, because it is always possible
inCheckMate [line 553]
boolean inCheckMate(
[W|B
$color = null])
|
|
Determine whether a side is in checkmate
Parameters:
inDraw [line 631]
boolean inDraw(
[W|B
$color = null])
|
|
Determines the presence of a forced draw
Parameters:
inRepetitionDraw [line 662]
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
Overridden in child classes as:
- Games_Chess_Crazyhouse::inRepetitionDraw()
- Repetition draw is not allowed in crazyhouse
inStaleMate [line 595]
boolean inStaleMate(
[W|B
$color = null])
|
|
Determine whether a side is in stalemate
Parameters:
isError [line 2277]
boolean isError(
mixed
$err)
|
|
Determines whether the data returned from a method is a PEAR-related error class
Parameters:
isPromoteMove [line 835]
boolean isPromoteMove(
string
$from, string
$to)
|
|
Determine whether moving a piece from one square to another requires a pawn promotion
Parameters:
moveSAN [line 412]
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
Overridden in child classes as:
- Games_Chess_Crazyhouse::moveSAN()
- Make a move from a Standard Algebraic Notation (SAN) format
Parameters:
moveSquare [line 506]
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 2139]
PEAR_Error raiseError(
integer
$code, [array
$extra = array()])
|
|
Parameters:
renderFen [line 758]
string renderFen(
[boolean
$include_moves = true])
|
|
render the FEN notation for the current board
Parameters:
resetGame [line 393]
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 2333]
void rollbackTransaction(
)
|
|
Undo any changes to state since startTransaction() was first used
setState [line 2304]
void setState(
array
$state)
|
|
Set the state of the chess game WARNING: this resets the state without any validation.
Parameters:
startTransaction [line 2288]
Begin a chess piece transaction Transactions are used to attempt moves that may be revoked later, especially in methods like inCheckMate()
toArray [line 822]
toMove [line 850]
_convertSquareToSAN [line 1293]
string|PEAR_Error _convertSquareToSAN(
string
$from, string
$to, [string
$promote = ''])
|
|
Convert a starting and ending algebraic square into SAN
Parameters:
_getAllPieceLocations [line 1763]
_getCastleSquares [line 1675]
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 2083]
B|W _getDiagonalColor(
string
$square)
|
|
Return the color of a square (black or white)
Parameters:
_getKingSquares [line 1705]
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 1625]
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 1606]
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 1540]
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 884]
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 908]
array _parseMove(
string
$move)
|
|
Parse out the segments of a move (minus any annotations)
Parameters:
_setupStartingPosition [line 985]
_validMove [line 1171]
Documentation generated on Mon, 11 Mar 2019 14:28:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|