Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            const int MAX = 35;
            string command = string.Empty;
            char[,] playfield = CreatePlayfield();
            char[,] bombs = PutBombs();
            int countResult = 0;
            bool explosionGameOver = false;
            List<Points> champions = new List<Points>(6);
            int row = 0;
            int col = 0;
            bool isGameOver = true;
            bool isPlayfieldCleared = false;

            do
            {
                if (isGameOver)
                {
                    Console.WriteLine("Lets play game 'Minesweeper'. Try your luck to find all fields without mine." +
                                      "Command 'top' show ranking, 'restart' start new game, 'exit' close application");
                    DrawPlayField(playfield);
                    isGameOver = false;
                }

                Console.Write("Write row and col separeted with space: ");
                command = Console.ReadLine().Trim();
                if (command.Length >= 3)
                {
                    if (int.TryParse(command[0].ToString(), out row) &&
                        int.TryParse(command[2].ToString(), out col) &&
                        row <= playfield.GetLength(0) &&
                        col <= playfield.GetLength(1))
                    {
                        command = "turn";
                    }
                }
                
                switch (command)
                {
                    case "top":
                        ShowRankList(champions);
                        break;
                    case "restart":
                        playfield = CreatePlayfield();
                        bombs = PutBombs();
                        DrawPlayField(playfield);
                        explosionGameOver = false;
                        isGameOver = false;
                        break;
                    case "exit":
                        Console.WriteLine("Bye, bye!");
                        break;
                    case "turn":
                        if (bombs[row, col] != '*')
                        {
                            if (bombs[row, col] == '-')
                            {
                                YourTurn(playfield, bombs, row, col);
                                countResult++;
                            }

                            if (MAX == countResult)
                            {
                                isPlayfieldCleared = true;
                            }
                            else
                            {
                                DrawPlayField(playfield);
                            }
                        }
                        else
                        {
                            explosionGameOver = true;
                        }

                        break;
                    default:
                        Console.WriteLine("\nError! Invalid command.\n");
                        break;
                }

                if (explosionGameOver)
                {
                    DrawPlayField(bombs);
                    Console.Write("\nBooooom! Game over! Result: {0} points.\nEnter your name: ", countResult);
                    string playerName = Console.ReadLine();
                    Points points = new Points(playerName, countResult);
                    if (champions.Count < 5)
                    {
                        champions.Add(points);
                    }
                    else
                    {
                        for (int i = 0; i < champions.Count; i++)
                        {
                            if (champions[i].Point < points.Point)
                            {
                                champions.Insert(i, points);
                                champions.RemoveAt(champions.Count - 1);
                                break;
                            }
                        }
                    }

                    champions.Sort((Points r1, Points r2) => r2.Name.CompareTo(r1.Name));
                    champions.Sort((Points r1, Points r2) => r2.Point.CompareTo(r1.Point));
                    ShowRankList(champions);

                    playfield = CreatePlayfield();
                    bombs = PutBombs();
                    countResult = 0;
                    explosionGameOver = false;
                    isGameOver = true;
                }

                if (isPlayfieldCleared)
                {
                    Console.WriteLine("\nWell done! Find 35 cells without blood.");
                    DrawPlayField(bombs);
                    Console.WriteLine("Enter your name: ");
                    string name = Console.ReadLine();
                    Points currentPlayerPoints = new Points(name, countResult);
                    champions.Add(currentPlayerPoints);
                    ShowRankList(champions);
                    playfield = CreatePlayfield();
                    bombs = PutBombs();
                    countResult = 0;
                    isPlayfieldCleared = false;
                    isGameOver = true;
                }
            }
            while (command != "exit");
            Console.WriteLine("Made in Bulgaria!\nBye.");
            Console.Read();
        }
        static void Main(string[] arguments)
        {
            string command = string.Empty;
            char[,] field = CreateGameField();
            char[,] bombs = PlaceBombs();
            int counter = 0;
            bool isBomb = false;
            List<Points> topScore = new List<Points>(6);
            int row = 0;
            int column = 0;
            bool isNewGame = true;
            const int maxPoints = 35;
            bool isWinner = false;

            do
            {
                if (isNewGame)
                {
                    Console.WriteLine("Lets play “Minesweeper”. Try yor luck and find fields without mines!");
                    Console.WriteLine("Commands:");
                    Console.WriteLine("'top' shows the charts");
                    Console.WriteLine("'restart' starts a new game");
                    Console.WriteLine("'exit' ends game");
                    GameField(field);
                    isNewGame = false;
                }

                Console.Write("Enter row and column (with a space between) : ");
                command = Console.ReadLine().Trim();
                if (command.Length >= 3)
                {
                    if (int.TryParse(command[0].ToString(), out row) &&
                    int.TryParse(command[2].ToString(), out column) &&
                        row <= field.GetLength(0) && column <= field.GetLength(1))
                    {
                        command = "turn";
                    }
                }

                switch (command)
                {
                    case "top":
                        Chart(topScore);
                        break;
                    case "restart":
                        field = CreateGameField();
                        bombs = PlaceBombs();
                        GameField(field);
                        isBomb = false;
                        isNewGame = false;
                        break;
                    case "exit":
                        Console.WriteLine("Good bye! Have a wonderfull day!");
                        break;
                    case "turn":
                        if (bombs[row, column] != '*')
                        {
                            if (bombs[row, column] == '-')
                            {
                                SurroundingBombCount(field, bombs, row, column);
                                counter++;
                            }
                            if (maxPoints == counter)
                            {
                                isWinner = true;
                            }
                            else
                            {
                                GameField(field);
                            }
                        }
                        else
                        {
                            isBomb = true;
                        }
                        break;
                    default:
                        Console.WriteLine("\nError! Invalid command!\n");
                        break;
                }

                if (isBomb)
                {
                    GameField(bombs);
                    Console.WriteLine("Game Over!");
                    Console.WriteLine("Your points: {0}", counter);
                    Console.WriteLine("Please enter your nickname: ");
                    string nickname = Console.ReadLine();
                    Points playerPoints = new Points(nickname, counter);
                    if (topScore.Count < 5)
                    {
                        topScore.Add(playerPoints);
                    }
                    else
                    {
                        for (int i = 0; i < topScore.Count; i++)
                        {
                            if (topScore[i].points < playerPoints.points)
                            {
                                topScore.Insert(i, playerPoints);
                                topScore.RemoveAt(topScore.Count - 1);
                                break;
                            }
                        }
                    }

                    topScore.Sort((Points playerOne, Points playerTwo) => playerTwo.Name.CompareTo(playerOne.Name));
                    topScore.Sort((Points playerOne, Points playerTwo) => playerTwo.points.CompareTo(playerOne.points));
                    Chart(topScore);

                    field = CreateGameField();
                    bombs = PlaceBombs();
                    counter = 0;
                    isBomb = false;
                    isNewGame = true;
                }

                if (isWinner)
                {
                    Console.WriteLine("\nCONGRATULATIONS! You opened all fields without a scratch!");
                    GameField(bombs);
                    Console.WriteLine("Please enter your nikname: ");
                    string nickname = Console.ReadLine();
                    Points points = new Points(nickname, counter);
                    topScore.Add(points);
                    Chart(topScore);
                    field = CreateGameField();
                    bombs = PlaceBombs();
                    counter = 0;
                    isWinner = false;
                    isNewGame = true;
                }
            }
            while (command != "exit");
            Console.WriteLine("Made in Bulgaria.");
            Console.WriteLine("See you soon.");
            Console.Read();
        }
Exemplo n.º 3
0
        static void Main(string[] arguments)
        {
            string command = string.Empty;
            char[,] field = CreateGameField();
            char[,] bombs = PlaceBombs();
            int counter = 0;
            bool mineExplosion = false;
            List<Points> championsList = new List<Points>(6);
            int row = 0;
            int column = 0;
            bool startNewGame = true;
            const int maxCells = 35;
            bool playerWin = false;

            do
            {
                if (startNewGame)
                {
                    Console.WriteLine("Let's play \"Minesweeper\"!");
                    Console.WriteLine("Try your luck to find fields without mines.");
                    Console.WriteLine("If you enter 'top' you'll see the ranking, 'restart' starts new game, 'exit' exits the game!");
                    dumpp(field);
                    startNewGame = false;
                }
                Console.Write("Enter row and column : ");
                command = Console.ReadLine().Trim();
                if (command.Length >= 3)
                {
                    if (int.TryParse(command[0].ToString(), out row) &&
                    int.TryParse(command[2].ToString(), out column) &&
                        row <= field.GetLength(0) && column <= field.GetLength(1))
                    {
                        command = "turn";
                    }
                }
                switch (command)
                {
                    case "top":
                        CreateRankings(championsList);
                        break;
                    case "restart":
                        field = CreateGameField();
                        bombs = PlaceBombs();
                        dumpp(field);
                        mineExplosion = false;
                        startNewGame = false;
                        break;
                    case "exit":
                        Console.WriteLine("Bye-bye!");
                        break;
                    case "turn":
                        if (bombs[row, column] != '*')
                        {
                            if (bombs[row, column] == '-')
                            {
                                MakePlayerTurn(field, bombs, row, column);
                                counter++;
                            }
                            if (maxCells == counter)
                            {
                                playerWin = true;
                            }
                            else
                            {
                                dumpp(field);
                            }
                        }
                        else
                        {
                            mineExplosion = true;
                        }
                        break;
                    default:
                        Console.WriteLine("\nError! Invalid command\n");
                        break;
                }
                if (mineExplosion)
                {
                    dumpp(bombs);
                    Console.Write("\nYou died like a hero with {0} points. " +
                        "Enter your nickname: ", counter);
                    string userNickname = Console.ReadLine();
                    Points points = new Points(userNickname, counter);
                    if (championsList.Count < 5)
                    {
                        championsList.Add(points);
                    }
                    else
                    {
                        for (int i = 0; i < championsList.Count; i++)
                        {
                            if (championsList[i].UserPoints < points.UserPoints)
                            {
                                championsList.Insert(i, points);
                                championsList.RemoveAt(championsList.Count - 1);
                                break;
                            }
                        }
                    }
                    championsList.Sort((Points r1, Points r2) => r2.UserName.CompareTo(r1.UserName));
                    championsList.Sort((Points r1, Points r2) => r2.UserPoints.CompareTo(r1.UserPoints));
                    CreateRankings(championsList);

                    field = CreateGameField();
                    bombs = PlaceBombs();
                    counter = 0;
                    mineExplosion = false;
                    startNewGame = true;
                }
                if (playerWin)
                {
                    Console.WriteLine("\nCongratulations! You opened 35 cells without any blood drop.");
                    dumpp(bombs);
                    Console.WriteLine("Please, enter your name: ");
                    string enteredName = Console.ReadLine();
                    Points currentPoints = new Points(enteredName, counter);
                    championsList.Add(currentPoints);
                    CreateRankings(championsList);
                    field = CreateGameField();
                    bombs = PlaceBombs();
                    counter = 0;
                    playerWin = false;
                    startNewGame = true;
                }
            }
            while (command != "exit");
            Console.WriteLine("Made in Bulgaria - You're the best!");
            Console.Read();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            string commandLine = string.Empty;
            char[,] gameField = CreateGameField();
            char[,] bombsLocation = PlaceBombs();
            int stepsCounter = 0;
            bool stepOnBomb = false;
            List<Points> topScorersList = new List<Points>(6);
            int row = 0;
            int col = 0;
            bool initialization = true;
            const int maxFreeFields = 35;
            bool endOfGame = false;

            do
            {
                if (initialization)
                {
                    Console.WriteLine("Hajde da igraem na “Mini4KI”. Probvaj si kasmeta da otkriesh poleteta bez mini4ki." +
                    " Komanda 'top' pokazva klasiraneto, 'restart' po4va nova igra, 'exit' izliza i hajde 4ao!");
                    InitializeGameField(gameField);
                    initialization = false;
                }
                Console.Write("Daj red i kolona : ");
                commandLine = Console.ReadLine().Trim();
                if (commandLine.Length >= 3)
                {
                    if (int.TryParse(commandLine[0].ToString(), out row) &&
                    int.TryParse(commandLine[2].ToString(), out col) &&
                        row <= gameField.GetLength(0) && col <= gameField.GetLength(1))
                    {
                        commandLine = "turn";
                    }
                }
                switch (commandLine)
                {
                    case "top":
                        Ranking(topScorersList);
                        break;
                    case "restart":
                        gameField = CreateGameField();
                        bombsLocation = PlaceBombs();
                        InitializeGameField(gameField);
                        stepOnBomb = false;
                        initialization = false;
                        break;
                    case "exit":
                        Console.WriteLine("4a0, 4a0, 4a0!");
                        break;
                    case "turn":
                        if (bombsLocation[row, col] != '*')
                        {
                            if (bombsLocation[row, col] == '-')
                            {
                                playerMove(gameField, bombsLocation, row, col);
                                stepsCounter++;
                            }
                            if (maxFreeFields == stepsCounter)
                            {
                                endOfGame = true;
                            }
                            else
                            {
                                InitializeGameField(gameField);
                            }
                        }
                        else
                        {
                            stepOnBomb = true;
                        }
                        break;
                    default:
                        Console.WriteLine("\nGreshka! nevalidna Komanda\n");
                        break;
                }
                if (stepOnBomb)
                {
                    InitializeGameField(bombsLocation);
                    Console.Write("\nHrrrrrr! Umria gerojski s {0} to4ki. " +
                        "Daj si niknejm: ", stepsCounter);
                    string playerNickName = Console.ReadLine();
                    Points playerPoints = new Points(playerNickName, stepsCounter);
                    if (topScorersList.Count < 5)
                    {
                        topScorersList.Add(playerPoints);
                    }
                    else
                    {
                        for (int playerCount = 0; playerCount < topScorersList.Count; playerCount++)
                        {
                            if (topScorersList[playerCount].PlayerPoints < playerPoints.PlayerPoints)
                            {
                                topScorersList.Insert(playerCount, playerPoints);
                                topScorersList.RemoveAt(topScorersList.Count - 1);
                                break;
                            }
                        }
                    }
                    topScorersList.Sort((Points r1, Points r2) => r2.PlayerName.CompareTo(r1.PlayerName));
                    topScorersList.Sort((Points r1, Points r2) => r2.PlayerPoints.CompareTo(r1.PlayerPoints));
                    Ranking(topScorersList);

                    gameField = CreateGameField();
                    bombsLocation = PlaceBombs();
                    stepsCounter = 0;
                    stepOnBomb = false;
                    initialization = true;
                }
                if (endOfGame)
                {
                    Console.WriteLine("\nBRAVOOOS! Otvri 35 kletki bez kapka kryv.");
                    InitializeGameField(bombsLocation);
                    Console.WriteLine("Daj si imeto, batka: ");
                    string playerNickName = Console.ReadLine();
                    Points playerPoints = new Points(playerNickName, stepsCounter);
                    topScorersList.Add(playerPoints);
                    Ranking(topScorersList);
                    gameField = CreateGameField();
                    bombsLocation = PlaceBombs();
                    stepsCounter = 0;
                    endOfGame = false;
                    initialization = true;
                }
            }
            while (commandLine != "exit");
            Console.WriteLine("Made in Bulgaria - Uauahahahahaha!");
            Console.WriteLine("AREEEEEEeeeeeee.");
            Console.Read();
        }
Exemplo n.º 5
0
        static void Main(string[] аргументи)
        {
            string command = string.Empty;
            char[,] gameField = CreatePlayingField();
            char[,] bombs = PlaceBombs();
            int counter = 0;
            bool loseCondition = false;
            List<Points> champions = new List<Points>(6);
            int row = 0;
            int col = 0;
            bool flag = true;
            const int MAX_CELLS = 35;
            bool winCondition = false;

            do
            {
                if (flag)
                {
                    Console.WriteLine("Lets play Minesweeper. Try to find out the fields without mines. Command 'top' shows leaderboard, 'restart' starts new game, 'exit' exits the game!");
                    CreatePlayingField(gameField);
                    flag = false;
                }
                Console.Write("Enter row and column : ");
                command = Console.ReadLine().Trim();
                if (command.Length >= 3)
                {
                    if (int.TryParse(command[0].ToString(), out row) &&
                    int.TryParse(command[2].ToString(), out col) &&
                        row <= gameField.GetLength(0) && col <= gameField.GetLength(1))
                    {
                        command = "turn";
                    }
                }
                switch (command)
                {
                    case "top":
                        Leaderboard(champions);
                        break;
                    case "restart":
                        gameField = CreatePlayingField();
                        bombs = PlaceBombs();
                        CreatePlayingField(gameField);
                        loseCondition = false;
                        flag = false;
                        break;
                    case "exit":
                        Console.WriteLine("Bye bye!");
                        break;
                    case "turn":
                        if (bombs[row, col] != '*')
                        {
                            if (bombs[row, col] == '-')
                            {
                                YourMove(gameField, bombs, row, col);
                                counter++;
                            }
                            if (MAX_CELLS == counter)
                            {
                                winCondition = true;
                            }
                            else
                            {
                                CreatePlayingField(gameField);
                            }
                        }
                        else
                        {
                            loseCondition = true;
                        }
                        break;
                    default:
                        Console.WriteLine("\nError, invalid command!\n");
                        break;
                }
                if (loseCondition)
                {
                    CreatePlayingField(bombs);
                    Console.Write("\nYou have died with {0} points. Enter your nickname: ", counter);
                    string nickname = Console.ReadLine();
                    Points currentPlayerNicknameAndScore = new Points(nickname, counter);
                    if (champions.Count < 5)
                    {
                        champions.Add(currentPlayerNicknameAndScore);
                    }
                    else
                    {
                        for (int i = 0; i < champions.Count; i++)
                        {
                            if (champions[i].PlayerPoints < currentPlayerNicknameAndScore.PlayerPoints)
                            {
                                champions.Insert(i, currentPlayerNicknameAndScore);
                                champions.RemoveAt(champions.Count - 1);
                                break;
                            }
                        }
                    }
                    champions.Sort((Points playerOne, Points playerTwo) => playerTwo.Name.CompareTo(playerOne.Name));
                    champions.Sort((Points playerOne, Points playerTwo) => playerTwo.PlayerPoints.CompareTo(playerOne.PlayerPoints));
                    Leaderboard(champions);

                    gameField = CreatePlayingField();
                    bombs = PlaceBombs();
                    counter = 0;
                    loseCondition = false;
                    flag = true;
                }
                if (winCondition)
                {
                    Console.WriteLine("\nCongratulations, you have found all fields without mines.");
                    CreatePlayingField(bombs);
                    Console.WriteLine("Enter your nickname: ");
                    string nickname = Console.ReadLine();
                    Points points = new Points(nickname, counter);
                    champions.Add(points);
                    Leaderboard(champions);
                    gameField = CreatePlayingField();
                    bombs = PlaceBombs();
                    counter = 0;
                    winCondition = false;
                    flag = true;
                }
            }
            while (command != "exit");

            Console.WriteLine("Made in Bulgaria - Uauahahahahaha!");
            Console.WriteLine("Fostata.");
            Console.Read();
        }
Exemplo n.º 6
0
		static void Main(string[] args)
		{
			string command = string.Empty;
			char[,] field = GenerateField();
			char[,] bombs = PlaceTheBombs();
			int counter = 0;
			bool detonation = false;
			List<Points> hallOfFame = new List<Points>(6);
			int row = 0;
			int column = 0;
			bool flag = true; // TODO: Check meaning!
            const int Max = 35; // TODO: Check meaning!
            bool flag2 = false; // TODO: Check meaning!

			do
			{
				if (flag)
				{
					Console.WriteLine("Hajde da igraem na “Mini4KI”. Probvaj si kasmeta da otkriesh poleteta bez mini4ki." +
					" Komanda 'top' pokazva klasiraneto, 'restart' po4va nova igra, 'exit' izliza i hajde 4ao!");
					dumpp(field);
					flag = false;
				}
				Console.Write("Daj red i kolona : ");
				command = Console.ReadLine().Trim();
				if (command.Length >= 3)
				{
					if (int.TryParse(command[0].ToString(), out row) &&
					int.TryParse(command[2].ToString(), out column) &&
						row <= field.GetLength(0) && column <= field.GetLength(1))
					{
						command = "turn";
					}
				}
				switch (command)
				{
					case "top":
						ScoreLadder(hallOfFame);
						break;
					case "restart":
						field = GenerateField();
						bombs = PlaceTheBombs();
						dumpp(field);
						detonation = false;
						flag = false;
						break;
					case "exit":
						Console.WriteLine("4a0, 4a0, 4a0!");
						break;
					case "turn":
						if (bombs[row, column] != '*')
						{
							if (bombs[row, column] == '-')
							{
								PlayersTurn(field, bombs, row, column);
								counter++;
							}
							if (Max == counter)
							{
								flag2 = true;
							}
							else
							{
								dumpp(field);
							}
						}
						else
						{
							detonation = true;
						}
						break;
					default:
						Console.WriteLine("\nGreshka! nevalidna Komanda\n");
						break;
				}
				if (detonation)
				{
					dumpp(bombs);
					Console.Write("\nHrrrrrr! Umria gerojski s {0} to4ki. " +
						"Daj si niknejm: ", counter);
					string niknejm = Console.ReadLine();
					Points t = new Points(niknejm, counter);
					if (hallOfFame.Count < 5)
					{
						hallOfFame.Add(t);
					}
					else
					{
						for (int i = 0; i < hallOfFame.Count; i++)
						{
							if (hallOfFame[i].PointsCount < t.PointsCount)
							{
								hallOfFame.Insert(i, t);
								hallOfFame.RemoveAt(hallOfFame.Count - 1);
								break;
							}
						}
					}
					hallOfFame.Sort((Points r1, Points r2) => r2.Name.CompareTo(r1.Name));
					hallOfFame.Sort((Points r1, Points r2) => r2.PointsCount.CompareTo(r1.PointsCount));
					ScoreLadder(hallOfFame);

					field = GenerateField();
					bombs = PlaceTheBombs();
					counter = 0;
					detonation = false;
					flag = true;
				}
				if (flag2)
				{
					Console.WriteLine("\nBRAVOOOS! Otvri 35 kletki bez kapka kryv.");
					dumpp(bombs);
					Console.WriteLine("Daj si imeto, batka: ");
					string name = Console.ReadLine();
					Points currentPoints = new Points(name, counter);
					hallOfFame.Add(currentPoints);
					ScoreLadder(hallOfFame);
					field = GenerateField();
					bombs = PlaceTheBombs();
					counter = 0;
					flag2 = false;
					flag = true;
				}
			}
			while (command != "exit");
			Console.WriteLine("Made in Bulgaria - Uauahahahahaha!");
			Console.WriteLine("AREEEEEEeeeeeee.");
			Console.Read();
		}
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            string command = string.Empty;
            char[,] field = CreateField();
            char[,] bombs = PlaceMinesField();
            int counter = 0;
            bool boom = false;
            List<Points> winners = new List<Points>(6);
            int row = 0;
            int column = 0;
            bool startGame = true;
            const int MaximalScore = 35;
            bool endGame = false;

            do
            {
                if (startGame)
                {
                    Console.WriteLine("Let's play Minesweeper. Try find field without mines!\n" +
                    "Command 'top' shows the ranking, 'restart' starts new game, 'exit' exits the game!");
                    PrintField(field);
                    startGame = false;
                }

                Console.Write("Give row and column : ");
                command = Console.ReadLine().Trim();
                if (command.Length >= 3)
                {
                    if (int.TryParse(command[0].ToString(), out row) &&
                    int.TryParse(command[2].ToString(), out column) &&
                        row <= field.GetLength(0) && column <= field.GetLength(1))
                    {
                        command = "turn";
                    }
                }

                switch (command)
                {
                    case "top":
                        GetRanking(winners);
                        break;
                    case "restart":
                        field = CreateField();
                        bombs = PlaceMinesField();
                        PrintField(field);
                        boom = false;
                        startGame = false;
                        break;
                    case "exit":
                        Console.WriteLine("Bye, Bye, Bye!");
                        break;
                    case "turn":
                        if (bombs[row, column] != '*')
                        {
                            if (bombs[row, column] == '-')
                            {
                                MakeMove(field, bombs, row, column);
                                counter++;
                            }

                            if (MaximalScore == counter)
                            {
                                endGame = true;
                            }
                            else
                            {
                                PrintField(field);
                            }
                        }
                        else
                        {
                            boom = true;
                        }

                        break;
                    default:
                        Console.WriteLine("\nError! Invalid command!\n");
                        break;
                }

                if (boom)
                {
                    PrintField(bombs);
                    Console.Write("\nBoooooom! You died with {0} points. Your Nickname: ", counter);
                    string nickname = Console.ReadLine();
                    Points newUserPoints = new Points(nickname, counter);
                    if (winners.Count < 5)
                    {
                        winners.Add(newUserPoints);
                    }
                    else
                    {
                        for (int i = 0; i < winners.Count; i++)
                        {
                            if (winners[i].TotalPoints < newUserPoints.TotalPoints)
                            {
                                winners.Insert(i, newUserPoints);
                                winners.RemoveAt(winners.Count - 1);
                                break;
                            }
                        }
                    }

                    winners.Sort((Points p1, Points p2) => p2.Name.CompareTo(p1.Name));
                    winners.Sort((Points p1, Points p2) => p2.TotalPoints.CompareTo(p1.TotalPoints));
                    GetRanking(winners);

                    field = CreateField();
                    bombs = PlaceMinesField();
                    counter = 0;
                    boom = false;
                    startGame = true;
                }

                if (endGame)
                {
                    Console.WriteLine("\nCongratulations! You open 35 cells!");
                    PrintField(bombs);
                    Console.WriteLine("Your Nickname: ");
                    string name = Console.ReadLine();
                    Points points = new Points(name, counter);
                    winners.Add(points);
                    GetRanking(winners);
                    field = CreateField();
                    bombs = PlaceMinesField();
                    counter = 0;
                    endGame = false;
                    startGame = true;
                }
            }
            while (command != "exit");
        }