Browse Source

Added support for one line pgn

master
DHTMLGoodies 5 years ago
parent
commit
a834acb72e
  1. 2
      PgnParser.php
  2. 82
      test/ParserTest.php
  3. 10
      test/pgn/greatgames-onelines.pgn
  4. 40
      test/pgn/greatgames-twolines.pgn
  5. 100
      test/pgn/greatgames.pgn

2
PgnParser.php

@ -65,6 +65,8 @@ class PgnParser
{
$c = $this->pgnContent;
$c = preg_replace('/"\]\s{0,10}\[/s', "]\n[", $c);
$c = preg_replace("/{\s{0,6}\[%emt[^\}]*?\}/","",$c);
$c = preg_replace("/\\$[0-9]+/s", "", $c);

82
test/ParserTest.php

@ -134,7 +134,6 @@ Qe7 28. e4 Nh7 29. h5 Nf8 30. Qb8 g5 31. Qc8 Ne6 32. Bxe6 Qxe6 33. Qxe6 fxe6
$parser->newGame();
$parser->move("Nf3");
$notation = $parser->getNotation();
echo $parser->getFen();
$this->assertEquals("Nf3", $notation);
@ -179,7 +178,6 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
$parser = new PgnParser();
$parser->setPgnContent($pgn);
$game = $parser->getFirstGame();
echo json_encode($game);
}
@ -1020,7 +1018,6 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
// when
$validBlackMoves = $parser->getValidMovesBoardCoordinates("black");
echo json_encode($validBlackMoves);
$validKingMoves = $validBlackMoves["g8"];
// then
@ -2051,7 +2048,6 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
$this->assertNotEmpty($game['white'], $game);
$this->assertNotEmpty($game['moves'][0]);
$m = json_encode($game['moves'][0]);
echo $m;
$this->assertNotEmpty($game['moves'][0]['clk'], "Move: ". $m);
$this->assertEquals('1:59:56',$game['moves'][0]['clk']);
@ -2101,11 +2097,6 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
}
private function getSpasskyFischerGameWith3FoldReptition(){
$parser = $this->getParser();
$moves = 'e4,d6,d4,g6,Nc3,Nf6,f4,Bg7,Nf3,c5,dxc5,Qa5,Bd3,Qxc5,Qe2,O-O,Be3,Qa5,O-O,Bg4,Rad1,Nc6,Bc4,Nh5,Bb3,Bxc3,bxc3,Qxc3,f5,Nf6,h3,Bxf3,Qxf3,Na5,Rd3,Qc7,Bh6,Nxb3,cxb3,Qc5+,Kh1,Qe5,Bxf8,Rxf8,Re3,Rc8,fxg6,hxg6,Qf4,Qxf4,Rxf4,Nd7,Rf2,Ne5,Kh2,Rc1,Ree2,Nc6,Rc2,Re1,Rfe2,Ra1,Kg3,Kg7,Rcd2,Rf1,Rf2,Re1,Rfe2,Rf1,Re3,a6,Rc3,Re1,Rc4,Rf1,Rdc2,Ra1,Rf2,Re1,Rfc2,g5,Rc1,Re2,R1c2,Re1,Rc1,Re2,R1c2';
@ -2151,4 +2142,77 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
$game = $pgnParser->getGames();
}
/**
* @test
*/
public function shouldParseTwoLinesPgn(){
// given
$pgnParser = new PgnParser("pgn/greatgames-twolines.pgn");
// when
$games = $pgnParser->getGames();
// then
$this->assertCount(10, $games);
$this->assertEquals("McDonnell,A", $games[0]["white"]);
}
/**
* @test
*/
public function shouldParseGreatGamesSameAsTwoLine(){
$parser1 = new PgnParser("pgn/greatgames-twolines.pgn");
$parser2 = new PgnParser("pgn/greatgames.pgn");
$games1 = $parser1->getGames();
$games2 = $parser2->getGames();
$this->assertCount(count($games2), $games1);
$count = count($games2);
for($i=0;$i<$count;$i++){
$expected = $games2[$i];
$game = $games1[$i];
$this->assertEquals($expected["white"], $game["white"]);
$this->assertEquals($expected["site"], $game["site"]);
$this->assertEquals($expected["black"], $game["black"]);
}
}
/**
* @test
*/
public function shouldParseGreatGamesSameAsOneLine(){
$parser1 = new PgnParser("pgn/greatgames-onelines.pgn");
$parser2 = new PgnParser("pgn/greatgames.pgn");
$games1 = $parser1->getGames();
$games2 = $parser2->getGames();
$this->assertCount(count($games2), $games1);
$count = count($games2);
$this->assertEquals("Immortal game", $games1[1]["event"]);
for($i=0;$i<$count;$i++){
$expected = $games2[$i];
$game = $games1[$i];
$this->assertEquals($expected["white"], $game["white"]);
$this->assertEquals($expected["site"], $game["site"]);
$this->assertEquals($expected["black"], $game["black"]);
}
}
}

10
test/pgn/greatgames-onelines.pgn

@ -0,0 +1,10 @@
[Event "4th match"][Site "London"][Date "1834.??.??"][Round "62"][White "McDonnell,A"][Black "De La Bourdonnais,L"][Result "0-1"] 1.e4 c5 2.Nf3 Nc6 3.d4 cxd4 4.Nxd4 e5 5.Nxc6 bxc6 6.Bc4 Nf6 7.Bg5 Be7 8.Qe2 d5 9.Bxf6 Bxf6 10.Bb3 O-O 11.O-O a5 12.exd5 cxd5 13.Rd1 d4 14.c4 Qb6 15.Bc2 Bb7 16.Nd2 Rae8 17.Ne4 Bd8 18.c5 Qc6 19.f3 Be7 20.Rac1 f5 21.Qc4+ Kh8 22.Ba4 Qh6 23.Bxe8 fxe4 24.c6 exf3 25.Rc2 Bc8 26.Bd7 Qe3+ 27.Kh1 f2 28.Rf1 d3 29.Rc3 Bxd7 30.cxd7 e4 31.Qc8 Bd8 32.Qc4 Qe1 33.Rc1 d2 34.Qc5 Rg8 35.Rd1 e3 36.Qc3 Qxd1 37.Rxd1 e2 0-1
[Event "Immortal game"][Site "London"][Date "1851.??.??"][Round "?"][White "Anderssen,A"][Black "Kieseritzky,L"][Result "1-0"] 1.e4 e5 2.f4 exf4 3.Bc4 Qh4+ 4.Kf1 b5 5.Bxb5 Nf6 6.Nf3 Qh6 7.d3 Nh5 8.Nh4 Qg5 9.Nf5 c6 10.g4 Nf6 11.Rg1 cxb5 12.h4 Qg6 13.h5 Qg5 14.Qf3 Ng8 15.Bxf4 Qf6 16.Nc3 Bc5 17.Nd5 Qxb2 18.Bd6 Qxa1+ 19.Ke2 Bxg1 20.e5 Na6 21.Nxg7+ Kd8 22.Qf6+ Nxf6 23.Be7+ 1-0
[Event "Evergreen game"][Site "Berlin"][Date "1852"][Round "?"][White "Anderss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