private static void HitTheBomb(bool isBomb, char[,] bombs, int counter, List<PlayersProfile> players, bool startGame, char[,] mineField) { if (isBomb) { MinesFieldOutline(bombs); Console.Write("\nHrrrrrr! You' ve been killed with {0} points. " + "Type your nickname: ", counter); string nickName = Console.ReadLine(); PlayersProfile playerOne = new PlayersProfile(nickName, counter); if (players.Count < 5) { players.Add(playerOne); } else { for (int i = 0; i < players.Count; i++) { if (players[i].Points < playerOne.Points) { players.Insert(i, playerOne); players.RemoveAt(players.Count - 1); break; } } } players.Sort((PlayersProfile r1, PlayersProfile r2) => r2.PlayerName.CompareTo(r1.PlayerName)); players.Sort((PlayersProfile r1, PlayersProfile r2) => r2.Points.CompareTo(r1.Points)); Clasification(players); mineField = CreateMineField(); bombs = BombGenerator(); counter = 0; isBomb = false; startGame = true; }; }
private static void EndTheGame(bool endGame, char[,] bombs, int counter, List<PlayersProfile> players, char[,] mineField, bool startGame) { if (endGame) { Console.WriteLine("\nCongratulations! You' ve successfully opened all the 35 cells."); MinesFieldOutline(bombs); Console.WriteLine("Type your name: "); string playerName = Console.ReadLine(); PlayersProfile points = new PlayersProfile(playerName, counter); players.Add(points); Clasification(players); mineField = CreateMineField(); bombs = BombGenerator(); counter = 0; endGame = false; startGame = true; }; }