Skip to content

Commit

Permalink
chore: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaxwood committed Aug 14, 2024
1 parent 183ad95 commit 5c04071
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/day23.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,7 @@ def longest_path_queue
if current == @goal && path.length > @current_longest
@current_longest = path.length - 1
else
next_positions = case [@forest_map[current], @dry]
when [:right, false]
[[current[0] + 1, current[1]]]
when [:down, false]
[[current[0], current[1] + 1]]
else
neighbors(current)
end

next_positions.each do |next_pos|
neighbors(current).each do |next_pos|
next unless @forest_map.key?(next_pos) && !visited.include?(next_pos) && @forest_map[next_pos] != :tree

new_visited = visited.dup
Expand Down

0 comments on commit 5c04071

Please sign in to comment.