Class: Client

Inherits:
Object
  • Object
show all
Defined in:
lib/another_toy_robot/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



5
6
7
8
9
10
# File 'lib/another_toy_robot/client.rb', line 5

def initialize
  @robot = Robot.new
  @table = Arena.new width: 5, height: 5

  @robot.arena = @table
end

Instance Method Details

#command_for(input) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/another_toy_robot/client.rb', line 12

def command_for(input)
  klass   = input.to_class
  params  = input.params
  command = klass.new target: @robot, params: params

  command.execute
end