public function move(Game $game, $level) { $oldForsyth = Forsyth::export($game); // hack to have chess960 working with Crafty if (!$game->isStandardVariant()) { $oldForsyth = $this->removeCastlingInfos($oldForsyth); } $newForsyth = $this->getNewForsyth($oldForsyth, $level); $move = Forsyth::diffToMove($game, $newForsyth); return $move; }
public function testDiffToMoveEnPassant() { $data = <<<EOF rnbqkbnr p pppppp Pp PPPPPPP RNBQKBNR EOF; $game = $this->createGame($data); $game->setTurns(4); $game->getBoard()->getPieceByKey('b5')->setFirstMove(3); $this->assertEquals('a5 b6', Forsyth::diffToMove($game, 'rnbqkbnr/p1pppppp/1P6/8/8/8/1PPPPPPP/RNBQKBNR b KQkq')); }