From a8151291884f10ce65324767e3e4eb19c0d3a34b Mon Sep 17 00:00:00 2001 From: DHTMLGoodies Date: Thu, 24 Dec 2015 01:39:00 +0100 Subject: [PATCH] Fixed problem with fens like 8/7P/8/8/1k15/8/P7/K7 w - - 0 1, i.e. 1k15(and not 1k6) --- FenParser0x88.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/FenParser0x88.php b/FenParser0x88.php index d929608..022dfc1 100644 --- a/FenParser0x88.php +++ b/FenParser0x88.php @@ -21,7 +21,15 @@ class FenParser0x88 private $fenParts = array(); - function setFen($fen) + /** + * Set new fen position + * Example: + * $parser = new FenParser0x88(); + * $parser->setFen('8/7P/8/8/1k15/8/P7/K7 w - - 0 1'); + * + * @param string $fen + */ + public function setFen($fen) { $this->cache = array( 'board' => array(), @@ -1102,7 +1110,23 @@ class FenParser0x88 $this->move($fromAndTo); } - function move($move) + /** + * Make a move on the board + * Example: + * + * $parser = new FenParser0x88(); + * $parser->newGame(); + * $parser->move("Nf3"); + * $notation = $parser->getNotation(); + * + * + * + * @param mixed $move + * @throws Exception + * + * $move can be a string like Nf3, g1f3 or an array with from and to squares, like array("from" => "g1", "to"=>"f3") + */ + public function move($move) { if(is_string($move) && strlen($move) == 4){