main
 1require "rover"
 2require "north"
 3require "east"
 4require "west"
 5require "south"
 6
 7class Plateau
 8  def initialize(x,y)
 9    @map = {:x => x.to_i, :y => y.to_i}
10    @directions = {:N => North.new, :E => East.new, :W => West.new, :S => South.new}
11  end
12
13  def deploy_rover_to(heading, x, y)
14    Rover.new(direction_for(heading),  x,  y, self)
15  end
16
17  def increment(axis, location)
18    location.increment(axis, @map)
19  end
20
21  def decrement(axis, location)
22    location.decrement(axis, @map)
23  end
24
25  private
26
27  def direction_for(heading)
28    @directions[heading.upcase.to_sym]
29  end
30end