Exemplo n.º 1
0
 protected function getCastleRookInDirection(Player $player, $dx)
 {
     $king = $player->getKing();
     if ($king->hasMoved()) {
         return null;
     }
     for ($x = $king->getX() + $dx; $x < 9 && $x > 0; $x += $dx) {
         if ($piece = $this->board->getPieceByPos($x, $king->getY())) {
             if ('Rook' === $piece->getClass() && !$piece->hasMoved() && $piece->getColor() === $king->getColor()) {
                 return $piece;
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * @depends testBoardCreation
  */
 public function testGetPieceByPos(Board $board)
 {
     $this->assertSame($board->getPieceByKey('a1'), $board->getPieceByPos(1, 1));
 }