Class: Lekanmastermind::Players

Inherits:
Object
  • Object
show all
Defined in:
lib/lekanmastermind/player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Players

Returns a new instance of Players.



4
5
6
7
# File 'lib/lekanmastermind/player.rb', line 4

def initialize(name)
  @name = name
  @history = []
end

Instance Attribute Details

#guessObject

Returns the value of attribute guess.



3
4
5
# File 'lib/lekanmastermind/player.rb', line 3

def guess
  @guess
end

#historyObject

Returns the value of attribute history.



3
4
5
# File 'lib/lekanmastermind/player.rb', line 3

def history
  @history
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/lekanmastermind/player.rb', line 3

def name
  @name
end

Instance Method Details

#save_guess(guess, exact_numb, partial_numb) ⇒ Object



9
10
11
12
# File 'lib/lekanmastermind/player.rb', line 9

def save_guess(guess, exact_numb, partial_numb)
  result = "#{exact_numb} exacts, #{partial_numb} partials"
  @history << [guess, result]
end