Class: Atoyrobot::Robot
- Inherits:
-
Object
- Object
- Atoyrobot::Robot
- Extended by:
- Dry::Initializer
- Defined in:
- lib/atoyrobot/robot.rb
Instance Method Summary collapse
Instance Method Details
#left ⇒ Object
18 19 20 |
# File 'lib/atoyrobot/robot.rb', line 18 def left location.rotate!(1) end |
#move ⇒ Object
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 |
#report ⇒ Object
26 27 28 |
# File 'lib/atoyrobot/robot.rb', line 26 def report puts location.report end |
#right ⇒ Object
22 23 24 |
# File 'lib/atoyrobot/robot.rb', line 22 def right location.rotate!(-1) end |