public static void Run() { bool isSuccessfulGuess = false; bool quitGame = false; ushort numberOfGuesses = UI.UIManager.GetNumberOfGuesses(); GameBoardData gameBoard = new GameBoardData(numberOfGuesses); while (!quitGame && !isSuccessfulGuess && gameBoard.TurnsPlayed < numberOfGuesses) { UI.UIManager.DisplayBoard(gameBoard); BullsAndCows.IO.UserReply userReply = UI.UIManager.GetUserGuess(); quitGame = userReply.QuitGame; if (!quitGame) { Pin[] userPinsSequence = userReply.UserPinsSequence; Turn newTurn = gameBoard.CompareUserGuess(userPinsSequence); gameBoard.AddTurn(newTurn); isSuccessfulGuess = newTurn.Results.CorrectInPlacePins == GProperties.PinsSequenceLength; } } if (!quitGame) { if(isSuccessfulGuess) { UI.UIManager.NotifySuccess(gameBoard.TurnsPlayed); } else { UI.UIManager.NotifyFailure(gameBoard.GoalSequence); } } }