Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support castling move with NAG in FenParser. #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions FenParser0x88.php
Original file line number Diff line number Diff line change
Expand Up @@ -1259,10 +1259,10 @@ function getFromAndToByNotation($notation)
case 0x03:
case 0x0B:

if ($notation === 'O-O') {
if (substr($notation, 0, 3) === 'O-O' && substr($notation, 0, 5) !== 'O-O-O') {
$foundPieces[] = ($offset + 4);
$ret['to'] = $offset + 6;
} else if ($notation === 'O-O-O') {
} else if (substr($notation, 0, 5) === 'O-O-O') {
$foundPieces[] = ($offset + 4);
$ret['to'] = $offset + 2;
} else {
Expand Down Expand Up @@ -1411,7 +1411,7 @@ function getToSquareByNotation($notation)

function getPieceTypeByNotation($notation, $color = null)
{
if ($notation === 'O-O-O' || $notation === 'O-O') {
if (substr($notation, 0, 5) === 'O-O-O' || substr($notation, 0, 3) === 'O-O') {
$pieceType = 'K';
} else {
$token = substr($notation, 0, 1);
Expand Down Expand Up @@ -1812,4 +1812,5 @@ private function getNewFen()

class FenParser0x88Exception extends Exception{

}
}