/** * @param integer $position * * @return $this */ public function get($position) { if ($this->position() !== $position) { return $this->nextSquare->get($position); } return $this; }
private function createStartingSquare() { $startingSquare = new Square(0); for ($position = 1; $position <= 45; $position++) { $startingSquare->nextTo(new Square($position)); } return $startingSquare; }
/** * @param integer $start * @param integer $length * * @return Square */ private function createChain($start, $length) { $square = new Square($start); for ($i = $start; $i <= $length; $i++) { $square->nextTo(new Square($i)); } return $square; }
/** * @param integer $start * @param integer $end * * @return Square */ private function createSquares($start, $end) { for ($position = $start; $position <= $end; $position++) { $this->squares->nextTo(new Square($position)); } return $this->squares; }
public function __construct(Player $occupiedBy) { parent::__construct(0); $this->occupiedBy = new Token($occupiedBy, new TokenNumber(1), $this); }
/** @return integer */ public function position() { return $this->square->position(); }