Class: Mastermind::Player

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

Direct Known Subclasses

Computer, Human

Defined Under Namespace

Classes: Computer, Human

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ Player

Returns a new instance of Player.



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

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#get_codeObject

Raises:



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

def get_code
  raise NotImplementedError.new("Abstract player cannot make code.")
end

#get_guess_for(game) ⇒ Object

Raises:



13
14
15
# File 'lib/mastermind/player.rb', line 13

def get_guess_for(game)
  raise NotImplementedError.new("Abstract player cannot guess code.")
end