lib/track.rb
# Returns pieces list sorted from in a top-bottom left-right manner
Returns pieces list sorted from in a top-bottom left-right manner
Returns pieces list sorted from in a top - bottom left - right manner
def graph_sorted
      pieces.sort do |piece, other_piece|
        if piece.y == other_piece.y
          piece.x <=> other_piece.x
        else
          other_piece.y <=> piece.y
        end
      end
    end
def graph_sorted pieces . sort do | piece , other_piece | if piece . y == other_piece . y piece . x <=> other_piece . x else other_piece . y <=> piece . y end end end
Returns pieces list sorted from in a top-bottom left-right manner
Returns pieces list sorted from in a top - bottom left - right manner