lib/aoc2021/puzzles/amphipod.rb
# Returns true/false whether a piece can move from start_x to destination_x.
Returns true/false whether a piece can move from start_x to destination_x.
Returns true / false whether a piece can move from start_x to destination_x .
def clear_path_to?(destination_x, start_x)
        range = if destination_x < start_x
                  destination_x..start_x - 1
                else
                  start_x + 1..destination_x
                end
        @board[range].filter { _1.is_a? Symbol }.all?(nil)
      end
def clear_path_to? ( destination_x , start_x ) range = if destination_x < start_x destination_x .. start_x - 1 else start_x + 1 .. destination_x end @board [ range ] . filter { _1 . is_a? Symbol } . all? ( nil ) end
Returns true/false whether a piece can move from start_x to destination_x.
Returns true / false whether a piece can move from start_x to destination_x .
destination_x
<not_specific>
start_x
<not_specific>