Example #1
0
 /**
  * @param integer $position
  *
  * @return $this
  */
 public function get($position)
 {
     if ($this->position() !== $position) {
         return $this->nextSquare->get($position);
     }
     return $this;
 }
Example #2
0
 private function createStartingSquare()
 {
     $startingSquare = new Square(0);
     for ($position = 1; $position <= 45; $position++) {
         $startingSquare->nextTo(new Square($position));
     }
     return $startingSquare;
 }
Example #3
0
 /**
  * @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;
 }
Example #4
0
 /**
  * @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);
 }
Example #6
0
 /** @return integer */
 public function position()
 {
     return $this->square->position();
 }