public void Initialize() { poker = new Poker(); poker.AddNewPlayer("Player1"); poker.AddNewBot("Pc1"); poker.AddNewBot("Pc2"); poker.AddNewBot("Pc3"); poker.AddNewBot("Pc4"); poker.InitGame(); }
public ActionResult Index(PlayerViewModel viewModel) { Poker poker = new Poker(); HttpContext.Session["Poker"] = poker; for (int i = 0; (i < viewModel.AmountOfBots && i < 5); i++) { poker.AddNewBot("Computer " + (i + 1)); } poker.AddNewPlayer(viewModel.Name); for (int i = 5; i < viewModel.AmountOfBots; i++) { poker.AddNewBot("Computer " + (i + 1)); } poker.InitGame(); Session["state"] = "Playing"; return View("Create", poker); }
public Poker CreateFirstPoker(string playerName) { Poker poker = new Poker(); activePlayers.ForEach(p => poker.AddExistingPlayer(p)); poker.InitGame(); poker.Host = poker.Players.FirstOrDefault(p => p.Name.Equals(playerName)); poker.Host.Opponents = poker.Players.Where(p => !p.Name.Equals(playerName)).ToList(); //Naam van de serverplayer setten zodat de controller hier ook aan kan MultiplayerGame.ServerPlayer = playerName; pokerPlayers.AddRange(poker.Players.ToList()); return poker; }