summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-02-12 14:36:50 -0700
committermo k <mo@mokhan.ca>2012-02-12 14:36:50 -0700
commitad9ab2585464ab34c8abdbe797e0c73aed36c8b5 (patch)
tree0196351b38fc5caf3643158db8a265999aa9c33c
parentf5ef080a6094062ba06235fbcf63884ed6f88039 (diff)
forward the terrain to the heading when moving forward.
-rw-r--r--lib/rover.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/rover.rb b/lib/rover.rb
index ec1356f..3e85ecf 100644
--- a/lib/rover.rb
+++ b/lib/rover.rb
@@ -14,7 +14,7 @@ class Rover
@heading = @heading.turn_left
end
def move_forward(terrain)
- @heading.forward(@location)
+ @heading.forward(@location, terrain)
end
end
@@ -25,7 +25,7 @@ class North
def turn_left
West.new
end
- def forward(current_location)
+ def forward(current_location, terrain)
current_location[:y] = current_location[:y]+1
end
end
@@ -36,7 +36,7 @@ class East
def turn_left
North.new
end
- def forward(current_location)
+ def forward(current_location, terrain)
current_location[:x] = current_location[:x]+1
end
end
@@ -47,7 +47,7 @@ class West
def turn_left
South.new
end
- def forward(current_location)
+ def forward(current_location, terrain)
current_location[:x] = current_location[:x]-1
end
end
@@ -58,7 +58,7 @@ class South
def turn_left
East.new
end
- def forward(current_location)
+ def forward(current_location, terrain)
current_location[:y] = current_location[:y]-1
end
end