public void Play() { var inGame = true; InitGame(); while (inGame) { var cmd = _consoleReader.ReadLineFromConsole(); if (string.IsNullOrEmpty(cmd)) { continue; } inGame = !_gameContext.Command(cmd); } _consoleReader.ReadLineFromConsole(); }
private void CheckExitGame() { _consoleWriter.WriteToConsole("Are you sure you want to exit the game ? [Exit / Quit] is not a valid in game command. " + "If you want to exit the game, press 'Y'"); var answer = _consoleReader.ReadLineFromConsole(); if (answer.Trim().EqualsIgnoreCase("Y")) { _isGameOver = true; } }