Skip to content

Instantly share code, notes, and snippets.

@darkash
Created December 16, 2020 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkash/c7622aa468b01b0b5c7301401e76f8e6 to your computer and use it in GitHub Desktop.
Save darkash/c7622aa468b01b0b5c7301401e76f8e6 to your computer and use it in GitHub Desktop.
AoC 2020 (day 3)
input = %w[..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#]
input.select.with_index do |x, idx|
max = x.length
new_s = x * (idx * 3 / max + 1)
new_s[idx * 3] == "#"
end.count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment