summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-02-12 14:19:44 -0700
committermo k <mo@mokhan.ca>2012-02-12 14:19:44 -0700
commitccbc65bd01a9c460539e936cfbc5eba8f97c0104 (patch)
tree1860e1a57878d4d525388a06d65a1f4e79913964 /lib
parenta1a0e9e7d63aa013fdfc54e87ce05ba776cd4135 (diff)
move forward when facing east or west.
Diffstat (limited to 'lib')
-rw-r--r--lib/rover.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rover.rb b/lib/rover.rb
index 35ab1f9..90d7757 100644
--- a/lib/rover.rb
+++ b/lib/rover.rb
@@ -42,6 +42,9 @@ class East
def turn_left
North.new
end
+ def forward(current_location)
+ current_location[:x] = current_location[:x]+1
+ end
end
class West
def direction
@@ -53,6 +56,9 @@ class West
def turn_left
South.new
end
+ def forward(current_location)
+ current_location[:x] = current_location[:x]-1
+ end
end
class South
def direction