1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
class Rover attr_reader :location def initialize(heading, coordinates) @heading = heading @location = coordinates end def heading @heading.class.name.downcase.to_sym end def turn_right @heading = @heading.turn_right end def turn_left @heading = @heading.turn_left end def move_forward(terrain) terrain.move_forward(@heading, @location) end end