private static void Menu() { InitializeTopPlayers(); string str = "restart"; int choosenRow = 0; int chosenColumn = 0; while (str != "exit") { if (str == "restart") { InitializeGameBoard(); Console.WriteLine("Welcome to the game “Minesweeper”. " + "Try to reveal all cells without mines. " + "Use 'top' to view the scoreboard, 'restart' to start a new game" + "and 'exit' to quit the game."); board.PrintGameBoard(); } else if (str == "exit") { Console.WriteLine("Good bye!"); Console.Read(); } else if (str == "top") { top(); } else if (str == "coordinates") { try { Board.Status status = board.OpenField(choosenRow, chosenColumn); if (status == Board.Status.SteppedOnAMine) { board.PrintAllFields(); int score = board.CountOpenedFields(); Console.WriteLine("Booooom! You were killed by a mine. You revealed " + score + " cells without mines."); if (CheckHighScores(score)) { Console.WriteLine("Please enter your name for the top scoreboard: "); string name = Console.ReadLine(); Player player = new Player(name, score); topadd(ref player); top(); } str = "restart"; continue; } else if (status == Board.Status.AlreadyOpened) { Console.WriteLine("Illegal move!"); } else if (status == Board.Status.AllFieldsAreOpened) { board.PrintAllFields(); int score = board.CountOpenedFields(); Console.WriteLine("Congratulations! You win!!"); if (CheckHighScores(score)) { Console.WriteLine("Please enter your name for the top scoreboard: "); string name = Console.ReadLine(); Player player = new Player(name, score); topadd(ref player); // pokazvame klasiraneto top(); } str = "restart"; continue; } else { board.PrintGameBoard(); } } catch (Exception) { Console.WriteLine("Illegal move"); } } Console.Write(System.Environment.NewLine + "Enter row and column: "); str = Console.ReadLine(); try { choosenRow = int.Parse(str); str = "coordinates"; } catch { // niama smisal tuka continue; } str = Console.ReadLine(); try { chosenColumn = int.Parse(str); str = "coordinates"; } catch (Exception) { continue; } } }