Class: Games_Chess
Source Location: /Games_Chess-0.9.1/Chess.php
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
addPiece [line 813]
blankBoard [line 376]
canCastleKingside [line 863]
boolean canCastleKingside(
)
|
|
Determine legality of kingside castling
canCastleQueenside [line 873]
boolean canCastleQueenside(
)
|
|
Determine legality of queenside castling
commitTransaction [line 2333]
void commitTransaction(
)
|
|
Remove any possibility of undo.
factory [line 358]
void &factory(
[
$type = 'Standard'])
|
|
Parameters:
gameOver [line 535]
getDiagonalColor [line 2101]
void getDiagonalColor(
$square)
|
|
Parameters:
getMessage [line 2162]
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 1751]
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 1807]
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 2057]
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 1782]
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 1406]
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 1976]
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 1957]
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 1882]
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 2325]
Get the current state of the chess game Use this in conjunction with setState
Parameters:
in50MoveDraw [line 679]
inBasicDraw [line 699]
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 635]
boolean inDraw(
[W|B
$color = null])
|
|
Determines the presence of a forced draw
Parameters:
inRepetitionDraw [line 666]
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 597]
boolean inStaleMate(
[W|B
$color = null])
|
|
Determine whether a side is in stalemate
Parameters:
isError [line 2285]
boolean isError(
mixed
$err)
|
|
Determines whether the data returned from a method is a PEAR-related error class
Parameters:
isPromoteMove [line 839]
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 2147]
PEAR_Error raiseError(
integer
$code, [array
$extra = array()])
|
|
Parameters:
renderFen [line 762]
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 2341]
void rollbackTransaction(
)
|
|
Undo any changes to state since startTransaction() was first used
setState [line 2312]
void setState(
array
$state)
|
|
Set the state of the chess game WARNING: this resets the state without any validation.
Parameters:
startTransaction [line 2296]
Begin a chess piece transaction Transactions are used to attempt moves that may be revoked later, especially in methods like inCheckMate()
toArray [line 826]
toMove [line 854]
_convertSquareToSAN [line 1301]
string|PEAR_Error _convertSquareToSAN(
string
$from, string
$to, [string
$promote = ''])
|
|
Convert a starting and ending algebraic square into SAN
Parameters:
_getAllPieceLocations [line 1771]
_getCastleSquares [line 1683]
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 2091]
B|W _getDiagonalColor(
string
$square)
|
|
Return the color of a square (black or white)
Parameters:
_getKingSquares [line 1713]
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 1633]
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 1614]
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 1548]
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 888]
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 912]
array _parseMove(
string
$move)
|
|
Parse out the segments of a move (minus any annotations)
Parameters:
_setupStartingPosition [line 989]
_validMove [line 1179]
Documentation generated on Mon, 11 Mar 2019 14:48:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|