Sha256: 6de72a01db9a5884612474335da4fac5218d3d196240a969912eada9b9b3d383
Contents?: true
Size: 781 Bytes
Versions: 5
Compression:
Stored size: 781 Bytes
Contents
# 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
Version data entries
5 entries across 5 versions & 1 rubygems