Class: RobotsFindKitten::Robot

Inherits:
Thing
  • Object
show all
Includes:
DRb::DRbUndumped
Defined in:
lib/robotsfindkitten/robot.rb

Instance Attribute Summary collapse

Attributes inherited from Thing

#symbol, #x, #y

Instance Method Summary collapse

Constructor Details

#initialize(server) ⇒ Robot

Returns a new instance of Robot.



11
12
13
14
15
16
# File 'lib/robotsfindkitten/robot.rb', line 11

def initialize(server)
  super()
  @symbol = '#'
  @message = ''
  @server = server
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



8
9
10
# File 'lib/robotsfindkitten/robot.rb', line 8

def message
  @message
end

#on_find_kittenObject

Returns the value of attribute on_find_kitten.



9
10
11
# File 'lib/robotsfindkitten/robot.rb', line 9

def on_find_kitten
  @on_find_kitten
end

Instance Method Details

#move_downObject



22
23
24
# File 'lib/robotsfindkitten/robot.rb', line 22

def move_down
  move(0, 1)
end

#move_leftObject



26
27
28
# File 'lib/robotsfindkitten/robot.rb', line 26

def move_left
  move(-1, 0)
end

#move_rightObject



30
31
32
# File 'lib/robotsfindkitten/robot.rb', line 30

def move_right
  move(1, 0)
end

#move_upObject



18
19
20
# File 'lib/robotsfindkitten/robot.rb', line 18

def move_up
  move(0, -1)
end