private static void PlayGame() { int consectRolledDoubles = 0; while (true) // Loop indefinitely { try { Console.Write("[" + Game.CurrentPlayer.Token + " > " + Game.Locations[Game.CurrentPlayer.CurrentPosition].Name + " - £" + Game.CurrentPlayer.Money + "] "); Console.WriteLine("Press Enter to roll!"); // Prompt string input = ""; string who = ""; if (Game.CurrentPlayer.Type == Player.PlayerType.Cpu) { Game.CpuPreRoll(); who = "[CPU]"; } else { input = Console.ReadLine(); // Get string from user who = "You"; } if (string.IsNullOrEmpty(input)) { Game.RollDice(); if (Game.CurrentPlayer.InJail) { Game.RollOutOfJail(Game.CurrentPlayer); continue; } if (Game.FirstDie == Game.SecondDie) { consectRolledDoubles++; if (consectRolledDoubles == 3) { Console.WriteLine("3 doubles in a row put you in Jail"); consectRolledDoubles = 0; Game.SendPlayerToJail(Game.CurrentPlayer); Game.NextPlayerTurn(); continue; } } else { consectRolledDoubles = 0; } Game.MovePlayer(Game.CurrentPlayer, Game.FirstDie, Game.SecondDie); string locName = Game.Locations[Game.CurrentPlayer.CurrentPosition].Name; Console.Write(who + " rolled " + Game.FirstDie + "/" + Game.SecondDie + " and landed on "); Console.WriteLine(locName); if (Game.Locations[Game.CurrentPlayer.CurrentPosition].LocType == LocationBase.LocationType.Street || Game.Locations[Game.CurrentPlayer.CurrentPosition].LocType == LocationBase.LocationType.Station || Game.Locations[Game.CurrentPlayer.CurrentPosition].LocType == LocationBase.LocationType.Utility) { if (!Game.Locations[Game.CurrentPlayer.CurrentPosition].Purchased) { if (Game.CurrentPlayer.Type == Player.PlayerType.Cpu) { Game.CpuPostRoll(Game.Locations[Game.CurrentPlayer.CurrentPosition], Game.CurrentPlayer); } else { int locCost = Game.Locations[Game.CurrentPlayer.CurrentPosition].TitleDeed.Cost; while (true) { Console.Write("Do you want to purchase '" + locName + "' for " + locCost + " (Y/N)?"); string answer = Console.ReadLine(); if (string.IsNullOrEmpty(answer)) { continue; } if (answer.ToLower() == "n") { break; } if (answer.ToLower() == "y") { if (locCost > Game.CurrentPlayer.Money) { //show payment options } Game.PurchaseLocation(Game.Locations[Game.CurrentPlayer.CurrentPosition], Game.CurrentPlayer); break; } } } } else { Game.HandleLandOnLocation(Game.Locations[Game.CurrentPlayer.CurrentPosition], Game.CurrentPlayer); } } if (Game.FirstDie == Game.SecondDie) { continue; } Game.NextPlayerTurn(); } if (WantsToQuit(input)) { break; } ProcessInput(input); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }