summaryrefslogtreecommitdiff
path: root/lib/rover.rb
blob: 591ec5a731009500fc81ddfdc1f48699c75fbb85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Rover
  attr_accessor :heading

  def initialize

  end
  def turn_right
    if(@heading == :north)
      @heading = :east
    elsif @heading == :east
      @heading = :south
    elsif @heading == :south
      @heading = :west
    end
  end
  def turn_left
    if(@heading == :north)
      @heading = :west
    elsif @heading == :east
      @heading = :north
    elsif @heading == :south
      @heading = :east
    end
  end
end