Class: Linotype::Player

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

Constant Summary collapse

DEFAULT_STRATEGY =
->(move) { (move.score[:defended] * 2) + move.score[:covered] }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Player

Returns a new instance of Player.



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

def initialize(args={})
  args = { strategy: DEFAULT_STRATEGY }.merge(args)
  self.strategy = args[:strategy]
end

Instance Attribute Details

#strategyObject

Returns the value of attribute strategy.



6
7
8
# File 'lib/linotype/player.rb', line 6

def strategy
  @strategy
end