Sha256: 817d37500abf64a1f67568910c008175d604875854802b29be0269c0af0c79a4

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require_relative 'helper'

class Ui
  include Helper
  def initialize
    puts 'Welcome to the game!'
  end

  def greeting
    puts 'Welcome to the Codebreaker'
  end

  def set_attempts(params)
    puts 'How many attempts do you need, to break the code?'
    verify(params).to_i
  end

  def user_input(params)
    puts "Please, enter 4 numbers in range from 1 to 6 or type 'hint'"
    verify(params)
  end

  def ask_position(params)
    puts 'What posotion would you like to open? (1,2,3,4)'
    verify(params).to_i - 1
  end

  def user_try(params)
    verify(params)
  end

  def show_hint(hint)
    puts hint
  end

  def no_hint
    puts '(!)There are no hints any more'
  end

  def show_plus_minus(plus_minus)
    puts plus_minus
  end

  def congratulations
    puts 'Congratulations, you breake the code!'
  end

  def sympathy(code)
    puts "Unfortunately, you lose. Secret code was : #{code}"
  end

  def play_again(params)
    puts 'Play again? (y/n)'
    verify(params)
  end

  def set_name
    puts 'Enter your name:'
    gets.strip.capitalize
  end

  def save?
    puts 'Would you like to save the result? (y/n)'
    return true if gets.strip.chomp == 'y'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
edg_codebreaker-0.1.0 lib/codebreaker/ui.rb