Class: Atoyrobot::Robot

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/atoyrobot/robot.rb

Instance Method Summary collapse

Instance Method Details

#leftObject



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

def left
  location.rotate!(1)
end

#moveObject



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

def move
  x, y = location.next_move
  board.valid_point!(x, y)
  location.set(x, y)
end

#place(x, y, facing) ⇒ Object



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

def place(x, y, facing)
  board.valid_point!(x, y)
  location.set(x, y, facing)
end

#reportObject



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

def report
  puts location.report
end

#rightObject



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

def right
  location.rotate!(-1)
end