Class: Mastermind::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Player

Returns a new instance of Player.



6
7
8
9
10
11
12
13
14
15
# File 'lib/mastermind/player.rb', line 6

def initialize(name)
  @secret     = ["X", "X", "X", "X"]
  @name       = name
  @round_over = false
  @guesses    = []
  @command    = ""
  @start_time = nil
  @completion_time = nil
  @turn_pos   = nil
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



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

def command
  @command
end

#completion_timeObject

Returns the value of attribute completion_time.



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

def completion_time
  @completion_time
end

#guessesObject

Returns the value of attribute guesses.



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

def guesses
  @guesses
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#round_overObject

Returns the value of attribute round_over.



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

def round_over
  @round_over
end

#secretObject

Returns the value of attribute secret.



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

def secret
  @secret
end

#start_timeObject

Returns the value of attribute start_time.



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

def start_time
  @start_time
end

#turn_posObject

Returns the value of attribute turn_pos.



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

def turn_pos
  @turn_pos
end