Class: TTT::Player
- Inherits:
-
Object
- Object
- TTT::Player
- Defined in:
- lib/tictactoe/player.rb
Instance Attribute Summary collapse
-
#difficulty_level ⇒ Object
Returns the value of attribute difficulty_level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(args = {}) ⇒ Player
Returns a new instance of Player.
5 6 7 8 9 10 |
# File 'lib/tictactoe/player.rb', line 5 def initialize(args = {}) @value = args.fetch(:value, "X") @name = args.fetch(:name, "Player 1") @type = args.fetch(:type, :computer) @difficulty_level = args.fetch(:difficulty_level, nil) end |
Instance Attribute Details
#difficulty_level ⇒ Object
Returns the value of attribute difficulty_level.
3 4 5 |
# File 'lib/tictactoe/player.rb', line 3 def difficulty_level @difficulty_level end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/tictactoe/player.rb', line 3 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/tictactoe/player.rb', line 3 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/tictactoe/player.rb', line 3 def value @value end |