Exemplo n.º 1
0
        private void CreateRound(Game game, int neededBotCount)
        {
            IEnumerable <Player> bots = _playerRepository.GetBots(neededBotCount);

            RoundPlayer user = new RoundPlayer {
                GameId = game.Id, PlayerId = _userId
            };
            var roundPlayers = new List <RoundPlayer> {
                user
            };

            foreach (var bot in bots)
            {
                RoundPlayer botRound = new RoundPlayer {
                    GameId = game.Id, PlayerId = bot.Id
                };
                roundPlayers.Add(botRound);
            }
            RoundPlayer dealer = new RoundPlayer {
                GameId = game.Id, PlayerId = Constants.DealerId
            };

            roundPlayers.Add(dealer);
            _roundPlayerRepository.Add(roundPlayers);

            CreateCards(roundPlayers);

            if (!IsStepPossible(game))
            {
                Skip();
            }
        }