aoc2020/day_03/first.rb

13 lines
217 B
Ruby

# frozen_string_literal: true
input = File.readlines './input'
width = input.first.strip.size
count = 0
input.each_with_index do |row, i|
next if i == 0
count += 1 if row[(i * 3) % width] == '#'
end
puts count