diff --git a/FenParser0x88.php b/FenParser0x88.php index 3a93199..cb70eca 100755 --- a/FenParser0x88.php +++ b/FenParser0x88.php @@ -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 { @@ -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); @@ -1812,4 +1812,5 @@ private function getNewFen() class FenParser0x88Exception extends Exception{ -} \ No newline at end of file +} + diff --git a/PgnGameParser.php b/PgnGameParser.php index 8ef93fc..16fcc73 100755 --- a/PgnGameParser.php +++ b/PgnGameParser.php @@ -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(); @@ -140,4 +141,4 @@ private function getMoveString() { $gameData = preg_replace("/(\s+)/", " ", $gameData); return trim($gameData); } -} \ No newline at end of file +}