◆ __construct()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::__construct |
( |
string | $fen | ) |
|
Create a new FenParser.
- Parameters
-
◆ getBishopCheckPath()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getBishopCheckPath |
( |
| $piece, |
|
|
| $king ) |
Get the path by which a bishop is checking a king.
- Parameters
-
- Returns
- array
◆ getCaptureAndProtectiveMoves()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getCaptureAndProtectiveMoves |
( |
| $color | ) |
|
Returns comma-separated string of moves (since it's faster to work with than arrays).
- Parameters
-
- Returns
- string
◆ getColor()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getColor |
( |
| ) |
|
Return color to move, "white" or "black".
- Returns
- string
- Exceptions
-
◆ getCountChecks()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getCountChecks |
( |
| $kingColor, |
|
|
| $moveString ) |
Counts the number of pieces checking the $king.
$king is set by FenParser0x88::parseFen and FenParser0x88::updatePieces where $king['s'] is the square the king occupies. To determine if the $king is in check, this method evaluates whether the square the king is on—$king['s']—is one (or more) of the squares the opponent's pieces can move to.
Because FenParser0x88::getCaptureAndProtectiveMoves returns a string, this method searches that string to see how many times the king's square is in that list. Because the string '2' would match both '2' and '22', we ensure that it matches all and only the integer representing the king's square by searching for the integer surrounded by commas. The mapping from integer to substring (needle) is stored in Board0x88Config::$keySquares.
- Parameters
-
string | $kingColor | Color of the king being checked; either 'white' or 'black' |
string | $moveString | a comma-delimited string of move targets, output by FenParser0x88::getCaptureAndProtectiveMoves. Each field is a square (represented by an integer) where the other player's pieces can move to. |
- See also
- FenParser0x88::getCaptureAndProtectiveMoves
-
Board0x88Config::$keySquares
- Returns
- int
◆ getEnPassantSquare()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getEnPassantSquare |
( |
| ) |
|
Returns en passant square or null.
- Returns
- int|null
◆ getFen()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getFen |
( |
| ) |
|
Returns FEN for current position.
- Returns
- string
◆ getFromAndToByNotation()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getFromAndToByNotation |
( |
| $notation | ) |
|
Get from and to by notation.
TODO document
- Parameters
-
- Returns
- array
- Exceptions
-
◆ getParsed()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getParsed |
( |
| $move | ) |
|
Get the parsed form of a move.
- Parameters
-
- Returns
- array
◆ getPinned()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getPinned |
( |
| $color | ) |
|
Return numeric squares(0x88) of pinned pieces.
- Parameters
-
- Returns
- array
◆ getRookCheckPath()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getRookCheckPath |
( |
| $piece, |
|
|
| $king ) |
Get the path by which a rook is chekcing a king.
- Parameters
-
- Returns
- array
◆ getSlidingPiecesAttackingKing()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getSlidingPiecesAttackingKing |
( |
| $color | ) |
|
Get a list of sliding pieces attacking the king of a color.
- Parameters
-
- Returns
- array
◆ getValidMovesAndResult()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getValidMovesAndResult |
( |
| ) |
|
Returns valid moves in 0x88 numeric format and result.
- Returns
- array
◆ getValidSquaresOnCheck()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::getValidSquaresOnCheck |
( |
| $color | ) |
|
Get valid squares for other pieces than king to move to when in check.
i.e. squares which avoids the check.
Example: if white king on g1 is checked by rook on g8, then valid squares for other pieces are the squares g2,g3,g4,g5,g6,g7,g8. Squares are returned in numeric format
- Parameters
-
- Returns
- array|null
◆ isCastleMove()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::isCastleMove |
( |
| $move | ) |
|
Check if a move is castling.
TODO combine ifs
- Parameters
-
- Returns
- bool
◆ isEnPassantMove()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::isEnPassantMove |
( |
| $move | ) |
|
Check if a move is en passant.
TODO combine ifs
- Parameters
-
- Returns
- bool
◆ isValid()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::isValid |
( |
| $move, |
|
|
| $fen ) |
Check if a move is valid.
- Parameters
-
- Returns
- bool
◆ move()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::move |
( |
| $move | ) |
|
Make a move on the board.
Example:
$parser = new FenParser0x88(); $parser->newGame(); $parser->move("Nf3");
$move can be a string like Nf3, g1f3 or an array with from and to squares, like array("from" => "g1", "to"=>"f3")
- Parameters
-
- Exceptions
-
◆ setFen()
MediaWiki\Extension\ChessBrowser\PgnParser\FenParser0x88::setFen |
( |
| $fen | ) |
|
Set new fen position Example: $parser = new FenParser0x88(); $parser->setFen('8/7P/8/8/1k15/8/P7/K7 w - - 0 1');.
- Parameters
-
The documentation for this class was generated from the following file:
- includes/PgnParser/FenParser0x88.php