Class: Games_Chess
Source Location: /Games_Chess-1.0.1/Chess.php
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
addPiece [line 819]
blankBoard [line 376]
canCastleKingside [line 869]
boolean canCastleKingside(
)
|
|
Determine legality of kingside castling
canCastleQueenside [line 879]
boolean canCastleQueenside(
)
|
|
Determine legality of queenside castling
commitTransaction [line 2345]
void commitTransaction(
)
|
|
Remove any possibility of undo.
factory [line 358]
void &factory(
[
$type = 'Standard'])
|
|
Parameters:
gameOver [line 535]
getDiagonalColor [line 2113]
void getDiagonalColor(
$square)
|
|
Parameters:
getMessage [line 2174]
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 1763]
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 1819]
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 2069]
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 1794]
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 1418]
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 1988]
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 1969]
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 1894]
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 2337]
Get the current state of the chess game Use this in conjunction with setState
Parameters:
in50MoveDraw [line 685]
inBasicDraw [line 705]
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 641]
boolean inDraw(
[W|B
$color = null])
|
|
Determines the presence of a forced draw
Parameters:
inRepetitionDraw [line 672]
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 600]
boolean inStaleMate(
[W|B
$color = null])
|
|
Determine whether a side is in stalemate
Parameters:
isError [line 2297]
boolean isError(
mixed
$err)
|
|
Determines whether the data returned from a method is a PEAR-related error class
Parameters:
isPromoteMove [line 845]
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 2159]
PEAR_Error raiseError(
integer
$code, [array
$extra = array()])
|
|
Parameters:
renderFen [line 768]
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 2353]
void rollbackTransaction(
)
|
|
Undo any changes to state since startTransaction() was first used
setState [line 2324]
void setState(
array
$state)
|
|
Set the state of the chess game WARNING: this resets the state without any validation.
Parameters:
startTransaction [line 2308]
Begin a chess piece transaction Transactions are used to attempt moves that may be revoked later, especially in methods like inCheckMate()
toArray [line 832]
toMove [line 860]
_convertSquareToSAN [line 1313]
string|PEAR_Error _convertSquareToSAN(
string
$from, string
$to, [string
$promote = ''])
|
|
Convert a starting and ending algebraic square into SAN
Parameters:
_getAllPieceLocations [line 1783]
_getCastleSquares [line 1695]
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 2103]
B|W _getDiagonalColor(
string
$square)
|
|
Return the color of a square (black or white)
Parameters:
_getKingSquares [line 1725]
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 1645]
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 1626]
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 1560]
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 894]
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 918]
array _parseMove(
string
$move)
|
|
Parse out the segments of a move (minus any annotations)
Parameters:
_setupStartingPosition [line 995]
_validMove [line 1191]
Documentation generated on Mon, 11 Mar 2019 15:05:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|