Class: Lekanmastermind::Players
- Inherits:
-
Object
- Object
- Lekanmastermind::Players
- Defined in:
- lib/lekanmastermind/player.rb
Instance Attribute Summary collapse
-
#guess ⇒ Object
Returns the value of attribute guess.
-
#history ⇒ Object
Returns the value of attribute history.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Players
constructor
A new instance of Players.
- #save_guess(guess, exact_numb, partial_numb) ⇒ Object
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
#guess ⇒ Object
Returns the value of attribute guess.
3 4 5 |
# File 'lib/lekanmastermind/player.rb', line 3 def guess @guess end |
#history ⇒ Object
Returns the value of attribute history.
3 4 5 |
# File 'lib/lekanmastermind/player.rb', line 3 def history @history end |
#name ⇒ Object
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 |