Skip to content

Commit

Permalink
Refactor/Rename Method: removed obsolete code I forgot about.
Browse files Browse the repository at this point in the history
  • Loading branch information
hemalvarambhia committed Oct 30, 2023
1 parent 7dd4f09 commit 76aabf3
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions lib/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,6 @@ def next_location_forwards(current_position:, direction:, location: nil)
end
end

def next_coordinate_forwards(current_position:, direction:)
case direction
when 'N'
next_y = at_top_edge?(current_position) ? @y_domain.begin : current_position.y + 1
Coordinates.new(x: current_position.x, y: next_y)
when 'E'
next_x = at_right_hand_edge?(current_position) ? @x_domain.begin : current_position.x + 1
Coordinates.new(x: next_x, y: current_position.y)
when 'S'
next_y = at_bottom_edge?(current_position) ? @y_domain.end : current_position.y - 1
Coordinates.new(x: current_position.x, y: next_y)
when 'W'
next_x = at_left_hand_edge?(current_position) ? @x_domain.end : current_position.x - 1
Coordinates.new(x: next_x, y: current_position.y)
end
end

def next_coordinate_backwards(current_position:, direction:)
case direction
when 'N'
Expand Down

0 comments on commit 76aabf3

Please sign in to comment.