updates
This commit is contained in:
@@ -66,7 +66,7 @@ class PgnParser
|
||||
$c = $this->pgnContent;
|
||||
|
||||
$c = preg_replace('/"\]\s{0,10}\[/s', "]\n[", $c);
|
||||
$c = preg_replace('/"\]\s{0,10}([\.0-9])/s', "\"]\n\n$1", $c);
|
||||
$c = preg_replace('/"\]\s{0,10}([\.0-9]|{)/s', "\"]\n\n$1", $c);
|
||||
|
||||
$c = preg_replace("/{\s{0,6}\[%emt[^\}]*?\}/","",$c);
|
||||
|
||||
|
@@ -2139,6 +2139,24 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function shouldHandleDifficultPgnWithArrowsAndSquares(){
|
||||
// given
|
||||
$pgnParser = new PgnParser("pgn/arrowtest.pgn");
|
||||
|
||||
// when
|
||||
$game = $pgnParser->getGameByIndex(0);
|
||||
|
||||
// then
|
||||
$this->assertEquals(8, count($game["moves"]));
|
||||
|
||||
$this->assertNotEmpty($game["moves"][0]);
|
||||
$m = $game["moves"][1];
|
||||
$this->assertEquals("Qxf7+", $m["m"], "MOVE: ". json_encode($game["moves"][0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
16
test/pgn/arrowtest.pgn
Normal file
16
test/pgn/arrowtest.pgn
Normal file
@@ -0,0 +1,16 @@
|
||||
[eventdate "1998.??.??"]
|
||||
[eventdate "1998.??.??"]
|
||||
[setup "1"]
|
||||
[castle "1"]
|
||||
[index "1"]
|
||||
[ts "1487793853499"]
|
||||
[event " White to move."]
|
||||
[site "?"]
|
||||
[date "1998.??.??"]
|
||||
[round "?"]
|
||||
[white "White mates in 4"]
|
||||
[black "White mates in 4 1001 Brilliant Ways to Checkmate"]
|
||||
[result "1-0"]
|
||||
[fen "r1b2rk1/pp1p1pp1/1b1p2B1/n1qQ2p1/8/5N2/P3RPPP/4R1K1 w - - 0 1"]
|
||||
[plycount "7"]
|
||||
{[%ar d5g8][%sq f7,h7]}1. Qxf7+{[%ar g6f7] [%sq g8]} Rxf7 2. Re8+ Rf8 3. Rxf8+ Kxf8 4. Re8#
|
Reference in New Issue
Block a user