class TictactoeGto::Player

Attributes

id[RW]

Public Class Methods

new(id) click to toggle source
# File lib/tictactoe_gto.rb, line 84
def initialize(id)
  @id = id
end

Public Instance Methods

customize?(id) click to toggle source
# File lib/tictactoe_gto.rb, line 88
def customize?(id)
  print "Player #{id}: Would you like to customize your ID? (y/n): "
  loop do
    option = gets.chomp
    30.times { print '_ ' }
    print "\n"
    if option == 'y'
      puts 'Nice! Here we go!'
      return true
    elsif option == 'n'
      puts 'Nice! Old school!'
      return false
    else
      puts '*Confused* I did not understand your input, could you try again, please?'
      puts "HINT: 'y' is for: 'Hell yeah!' and 'n' is for: 'No, thanks. Maybe later'"
    end
    30.times { print '_ ' }
    print "\n"
  end
end