public Game() { StartGame(); while (loop) { var input = ReadKey(true).Key; switch (input) { case A: if (pos1 - 1 == -1) { break; } pos1--; break; case S: if (pos2 + 1 == rows) { break; } pos2++; break; case D: if (pos1 + 1 == cols) { break; } pos1++; break; case W: if (pos2 - 1 == -1) { break; } pos2--; break; case F: board.Flag(pos2, pos1); break; case Enter: board.Open(pos2, pos1); break; default: SetCursorPosition(0, 1); Write("Wrong input. "); break; } if (board.CheckWin()) { break; } if (!loop) { continue; } SetCursorPosition(pos1 * 5 + 2, pos2 + 3); } WriteLine('\n' + (loop ? "You won the game!" : "You lost the game!") + "\nPress 'R' to end the game."); while (ReadKey(true).Key != R) { } }