コード例 #1
0
ファイル: EnPassantTest.php プロジェクト: hafeez3000/lichess
 /**
  * Moves a piece and increment game turns
  *
  * @return void
  **/
 protected function move($move, array $options = array())
 {
     $manipulator = new TestManipulator($this->game, new \Bundle\LichessBundle\Document\Stack());
     $manipulator->move($move, $options);
     $this->game->getBoard()->compile();
     $this->game->addTurn();
 }
コード例 #2
0
ファイル: ForsythTest.php プロジェクト: hotfics/lichess-old
 public function testExport()
 {
     $generator = new Generator();
     $game = $generator->createGame();
     $manipulator = new TestManipulator($game, new ArrayObject());
     $this->assertEquals('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', Forsyth::export($game));
     $manipulator->play('e2 e4');
     $this->assertEquals('rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1', Forsyth::export($game));
     $manipulator->play('c7 c5');
     $this->assertEquals('rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2', Forsyth::export($game));
     $manipulator->play('g1 f3');
     $this->assertEquals('rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2', Forsyth::export($game));
     $manipulator->play('g8 h6');
     $this->assertEquals('rnbqkb1r/pp1ppppp/7n/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3', Forsyth::export($game));
     $manipulator->play('a2 a3');
     $this->assertEquals('rnbqkb1r/pp1ppppp/7n/2p5/4P3/P4N2/1PPP1PPP/RNBQKB1R b KQkq - 0 3', Forsyth::export($game));
 }
コード例 #3
0
ファイル: PromotionTest.php プロジェクト: hafeez3000/lichess
 /**
  * Moves a piece and increment game turns
  *
  * @return void
  **/
 protected function move($move, array $options = array())
 {
     $manipulator = new TestManipulator($this->game, new \Bundle\LichessBundle\Document\Stack());
     $manipulator->play($move, $options);
 }
コード例 #4
0
ファイル: PlayTest.php プロジェクト: hafeez3000/lichess
 /**
  * apply moves
  **/
 protected function applyMoves(array $moves)
 {
     $manipulator = new TestManipulator($this->game, new \Bundle\LichessBundle\Document\Stack());
     foreach ($moves as $move) {
         $manipulator->play($move);
     }
 }
コード例 #5
0
ファイル: StackTest.php プロジェクト: hafeez3000/lichess
    public function testCheck()
    {
        $data = <<<EOF

 Q
   k




K
EOF;
        $game = $this->createGame($data);
        $this->game->getBoard()->getPieceByKey('b7')->setFirstMove(1);
        $stack = new Stack();
        $manipulator = new TestManipulator($this->game, $stack);
        $manipulator->play('b7 b6', array('promotion' => 'Knight'));
        $this->assertEquals(array(array('type' => 'move', 'from' => 'b7', 'to' => 'b6', 'color' => 'white'), array('type' => 'check', 'key' => 'd6')), $stack->getEvents());
    }