Skip to content
Open
Show file tree
Hide file tree
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{

}
}

3 changes: 2 additions & 1 deletion PgnGameParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class PgnGameParser{

private $pgnGame;
private $moveBuilder;
private $defaultFen = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1';

private $gameData = array();
Expand Down Expand Up @@ -140,4 +141,4 @@ private function getMoveString() {
$gameData = preg_replace("/(\s+)/", " ", $gameData);
return trim($gameData);
}
}
}