public void StartApplication() { bool startNewGame = true; while (startNewGame) { Console.Clear(); Console.WriteLine("Enter secret phrase to start game: "); var secret = Console.ReadLine(); string entered = null; _service.SetSecret(secret); while (!_service.IsGameFinished()) { Console.Clear(); var model = _service.NextStep(String.IsNullOrEmpty(entered) ? null : entered[0]); ConsoleDrawMan(model.HangManStatus); ConsoleDrawData(model); ConsoleDrawResult(model); entered = Console.ReadLine(); if (IsSomeErrors(model)) { break; } } Console.WriteLine("Do you want to start over? Y/N _"); var result = Console.ReadLine(); startNewGame = result?.ToUpper() == "Y"; } }
public HangManServiceTest() { _service = new HangManService(); _service.SetSecret(_secretValue); _modelInit = new HangManModel() { EnteredChars = new List <char>(), HangManStatus = HangManStatus.Clear, PlayerStatus = PlayerStatus.Playing, AnswearChars = new char[] { '_', '_', '_', '_', '_', '_', '_', '_', '_' } }; }