Exemplo n.º 1
0
 /**
  * @return GameGearsInterface
  */
 public function getGameGears()
 {
     if (null === $this->gameId) {
         throw new \RuntimeException('Game-ID has to be set prior to using the Ledger!');
     }
     if (null === $this->gameGears) {
         $this->gameGears = $this->tournamentEngine->getGameGearsForGameId($this->gameId);
         if (null === $this->gameGears) {
             throw new \RuntimeException(sprintf('Game-Gears for Game-ID %d not found!', $this->gameId));
         }
     }
     return $this->gameGears;
 }
Exemplo n.º 2
0
 /**
  * @return TournamentEngineInterface
  */
 public function getTournamentEngine()
 {
     $this->tournamentEngine->ensureReady();
     return $this->tournamentEngine;
 }
Exemplo n.º 3
0
 protected function playGame2(TournamentEngineInterface $engine, Ledger $ledger)
 {
     /** @var GameGearsInterface $group0Game1Gears */
     $group0Game1Gears = $engine->getCurrentRoundGears()->getGameGearsGrouped()[0][2];
     $game = $group0Game1Gears->getGame();
     $ledger->setGameId($game->getId());
     // player 1
     $ledger->registerShot(Arrow::create(1, Arrow::MULTIPLIER_SINGLE));
     $ledger->registerShot(Arrow::create(20, Arrow::MULTIPLIER_TRIPLE));
     $ledger->registerShot(Arrow::create(20, Arrow::MULTIPLIER_TRIPLE));
     // player 2
     $ledger->registerShot(Arrow::create(7, Arrow::MULTIPLIER_SINGLE));
     $ledger->registerShot(Arrow::create(19, Arrow::MULTIPLIER_TRIPLE));
     $ledger->registerShot(Arrow::create(16, Arrow::MULTIPLIER_DOUBLE));
     // player 1
     $ledger->registerShot(Arrow::create(20, Arrow::MULTIPLIER_TRIPLE));
     $ledger->registerShot(Arrow::create(20, Arrow::MULTIPLIER_TRIPLE));
     $ledger->registerShot(Arrow::create(20, Arrow::MULTIPLIER_TRIPLE));
     // player-1 won...
     $game = $ledger->getGame();
     $this->assertTrue($game->isClosed());
 }