static void Main(string[] args) { //This is the gameplay loop bool stay = true; do { bool gameOver = false; //instantiating a board with user input Console.WriteLine("Please enter in the size of the board you want"); int size = int.Parse(Console.ReadLine()); Board game = new Board(size); Console.WriteLine("What would you like the difficulty to be? 1-9"); int diff = int.Parse(Console.ReadLine()); int goal = size * ((diff * 10) / 100); int cleared = 0; //Setting up the board game.createBombs(diff); game.checkNeighbors2(); printBoard(game); //The loop to continue playing a match until you actually lose while (!gameOver) { Console.WriteLine("Please choose a row and then column"); try { int x = int.Parse(Console.ReadLine()) - 1; int y = int.Parse(Console.ReadLine()) - 1; if (game.grid[x, y].Live == true) { gameOver = true; Console.WriteLine("You lose! Enter 1 to try again"); if (int.Parse(Console.ReadLine()) == 1) { break; } else { stay = false; break; } } else if (cleared == goal - 1) { gameOver = true; Console.WriteLine("You win!!! Enter 1 to play again"); if (int.Parse(Console.ReadLine()) == 1) { break; } else { stay = false; break; } } else { game.floodFill(x, y); //game.grid[x, y].visited = true; cleared++; printBoard(game); } } catch (FormatException e) { Console.WriteLine("Please enter a number, and then another number"); } catch (IndexOutOfRangeException f) { Console.WriteLine("Please enter a number below the size that you set and not negative"); } } } while (stay); }