コード例 #1
0
ファイル: Crafty.php プロジェクト: hafeez3000/lichess
 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;
 }
コード例 #2
0
ファイル: ForsythTest.php プロジェクト: hotfics/lichess-old
    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'));
    }