Esempio n. 1
0
 /**
  * @param Player      $player
  * @param TokenNumber $number
  * @param Dice        $dice
  *
  * @throws DomainException If the token is not on the track or if the token is already finished.
  */
 public function moveToken(Player $player, TokenNumber $number, Dice $dice)
 {
     if ($this->track->has($player, $number)) {
         $this->track->select($player, $number)->move($dice->value());
     } elseif ($dice->equals(6)) {
         $this->takeFromYard($player, $number);
     }
 }
Esempio n. 2
0
 /** @test */
 public function rollAllot()
 {
     for ($count = 1; $count <= 100; $count++) {
         $this->dice->roll();
         if ($this->dice->value() > $this->sides) {
             throw new DomainException('Dice roll went beyond its max.');
         }
     }
 }
Esempio n. 3
0
 /**
  * @param int $sides
  * @param int $value
  */
 public function __construct($sides, $value)
 {
     parent::__construct($sides);
     $this->value = $value;
 }