/**
  * Create a table with a specific number of seats.
  * All seats are assigned a computer player until a real player joins.
  *
  * @param int $seats
  *
  * @return Table
  */
 public function createTable($seats = 5)
 {
     $table = new WebSocketObservableTable($seats);
     $index = 0;
     foreach ($table->getSeats() as $seat) {
         $player = $this->playerFactory->newServerPlayer('Bot' . $index++, $seat, 5000);
         $seat->setPlayer($player);
     }
     $this->logger->info('Created new table', ['id' => $table->getId()]);
     $loop = $this->tableLoopFactory->createLoop($table);
     $this->tableLoopMap->attach($table, $loop);
     $this->tables->pushBack($table);
     return $table;
 }
 private function removePlayerFromSeat(TableSeat $seat, $assignBot = true)
 {
     if ($seat->isFree()) {
         throw new \LogicException('Unable to remove player from empty seat.');
     }
     $this->logger->info('Removing player from seat', ['player' => $seat->getPlayer()->getName(), 'table_id' => $seat->getTable()->getId()]);
     $player = $seat->getPlayer();
     $table = $seat->getTable();
     $seat->setPlayer(null);
     $seat->setInPlay(false);
     $seat->resetHand();
     $player->setSeat(null);
     $this->broadcastMessageIgnoringPlayer($table, $player, new SocketPlayerLeftTableMessage($seat->getSeatIndex()));
     if ($table instanceof WebSocketObservableTable) {
         $table->broadcast(new WebSocketPlayerLeftTableMessage($seat->getSeatIndex()));
     }
     if ($assignBot) {
         $bot = $this->playerFactory->newServerPlayer('Bot' . $seat->getSeatIndex(), $seat, 5000);
         $this->assignPlayerToSeat($seat, $bot);
     }
 }