Class: TTT::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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_levelObject

Returns the value of attribute difficulty_level.



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

def difficulty_level
  @difficulty_level
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#valueObject

Returns the value of attribute value.



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

def value
  @value
end