# frozen_string_literal: true module Codebreaker class Console attr_reader :game include Phrases include Storage include Validator include InputHelper def initialize(name, complexity) @game = Game.new(name, complexity) end def play phrase_before_guess user_guess = user_input('guess') if user_guess == COMMANDS[:hint] show_hint else check_game_answer @game.guess user_guess end end private def check_game_answer(answer) case answer when :win then phrase_win when :lose then phrase_lose else show answer play end end def show_hint hint = @game.hint hint ? puts_hint(hint) : zero_hint play end end end