private static void PlayTheGame(Deck deck, Display display) { string playAgain = "y"; Console.WriteLine(""); List <Player> players = new List <Player>(); players.Add(new Player("Daniel", 500, display, false)); players.Add(new Player("Matt", 500, display, true)); players.Add(new Player("John", 500, display, true)); players.Add(new Player("Ruben", 500, display, true)); Table table = new Table(deck, players); while (playAgain == "y") { table.StartGame(); display.SkipLine(); foreach (Player player in players) { player.ShowPlayerCash(); } display.SkipLine(); Console.Write("Play Again? y/n "); playAgain = Console.ReadLine(); display.Clear(); } }
private static void Infinite(IDeck deck, Display display) { bool playAgain = true; int timesPlayed = 0; Console.WriteLine(""); List <Player> players = new List <Player>(); players.Add(new Player("Daniel", 500, display, true)); players.Add(new Player("Matt", 500, display, true)); players.Add(new Player("John", 500, display, true)); players.Add(new Player("Ruben", 500, display, true)); Table table = new Table(deck, players, display); while (playAgain) { display.SkipLine(); display.Clear(); playAgain = false; table.StartGame(); display.SkipLine(); foreach (Player player in players) { player.ShowPlayerCash(); if (player.Cash > 0) { playAgain = true; } } timesPlayed += 1; Console.WriteLine("At least 1 player still has money. Playing again. Times played: {0}", timesPlayed); display.Wait(); display.Wait(); } display.Wait(); display.Wait(); Console.ReadLine(); }