Skip to content

Commit

Permalink
Fake it til we make it: we can move to and past the south pole of Mars.
Browse files Browse the repository at this point in the history
  • Loading branch information
hemalvarambhia committed Oct 31, 2023
1 parent 3a05e09 commit 1068a7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def next_location_forwards(location:)
direction: location.direction
)
if located_at_south_pole? new_location.coordinates
Location.new(coordinates: new_location.coordinates, direction: 'N')
Location.new(coordinates: Coordinates.new(x: 18, y: -8), direction: 'N')
else
new_location
end
Expand Down
8 changes: 7 additions & 1 deletion spec/moving_forwards_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ def self.mars_rover(map: Map.new(x_domain: (0..10), y_domain: (0..10)), located_
expect(mars_rover).to be_facing('N')
end

it 'can move to the south pole of the planet'
it 'can move to the south pole of the planet' do
mars_rover = a_mars_rover(located_at: Location.new(coordinates: Coordinates.new(x: 0, y: -8), direction: 'S'))

mars_rover.execute(['f'])

expect(mars_rover).to be_located_at(Coordinates.new(x: 18, y: -8))
end
end

private
Expand Down

0 comments on commit 1068a7a

Please sign in to comment.