Compare commits

...

7 Commits

Author SHA1 Message Date
Jeff Yates 7c1f6ae89c finished solution 2 2020-12-08 10:15:46 -05:00
Jeff Yates 10794e411f finished solution 1 2020-12-06 08:11:51 -05:00
Jeff Yates 10d8a8079c added input files 2020-12-06 07:13:26 -05:00
Jeff Yates 0827c0f9ca finished solution 2020-12-06 07:13:02 -05:00
Jeff Yates ce5312d26c fixed input.sample name 2020-12-05 06:57:15 -05:00
Jeff Yates b5da43d84d Merge branch 'master' of http://git.doublehack.me/s00ner/AoC2020 into master 2020-12-05 06:32:41 -05:00
Jeff Yates 70b0fc318f added inputs files 2020-12-05 06:32:39 -05:00
7 changed files with 2937 additions and 0 deletions

815
day05/input Normal file
View File

@ -0,0 +1,815 @@
BFBBFFFLRR
FFBFBBBLLL
FBFBFBFLLL
BBFFFBFLLR
FBFFBBFLRR
BBFBFFFLLL
FFBBFFFRLL
BFBFBBBRRR
FBFFBFFRLR
FBBBBBBLLL
BBFBBBBLLL
BFFFBBBLLL
FFBFFFBRLR
BFFFFBFLLR
FFBBBFBLRL
BFFBFBBRRL
FBFBFBBRRR
FBFFFBBRRL
FBFBBBFRLR
BFFFFFBRRL
BBFFFBBLRR
FFBBBBBRRR
FFBBBBBLLL
BBFBFFBRLR
FBFFBFBRRR
FFFBBBBRLL
BBFBFFBLLR
BFBFFFBRLL
FFBFBFFLLR
FBFBBFBRLL
FBFFBBBLLL
FBFBBBFRLL
FBFBFBBRLL
BFFFFBBRLL
FFFBBFFLLR
FFBFFFBLRL
FFBFBBFLLL
BFBBFBBLLL
BFFFFBBRRL
FFBFFFBRLL
BFBBFFFRRR
FFBBFFFLRL
FFBFBFBRLL
BFBFBBBLLL
BBFBBFFLRL
BFFFFBBLLR
FFBFBBFRLR
FFBBFBBLLR
FBFFBBFLLL
BFBFBFBLLL
BFFBFBBLLR
FBBBBFFRLR
FBBBFBFRLL
FBBBBFFLRR
BFFBBBBLRL
FBFFBBFLRL
BBFFFBBLLR
FBFBFFFRLL
FBBBFBBR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BFRLL
BBBFFFBLRR
BFFFBBFLLR
FBFFBFFRLL
FFBBBBFLLL
FFBBBFBRRR
BBFBBFFRLR
FBBBFBBLLR
FBBFBFFRRR
BFBBFBFRLL
FFFBBBBRRL
FBFBFFBRRL

3
day05/input.sample Normal file
View File

@ -0,0 +1,3 @@
BFFFBBFRRR
FFFBBBFRRR
BBFFBBFRLL

34
day05/solution01.rb Executable file
View File

@ -0,0 +1,34 @@
#!/bin/env ruby
ids = []
File.readlines('./input').each do |line|
line.strip!
row = [0, 127]
col = [0, 7]
step = 64
line[..6].each_char do |char|
row[0] += step if char == 'B'
row[1] -= step if char == 'F'
step /= 2
end
step = 4
line[-3..].each_char do |char|
col[0] += step if char == 'R'
col[1] -= step if char == 'L'
step /= 2
end
id = (row[0] * 8) + col[0]
ids.push(id)
puts "Seat #{line} is at row #{row} and column #{col}. Seat id: #{id}"
end
puts "The highest seat ID is #{ids.max}"
ids.sort!
ids.each_index do |i|
next if i == 0
if ids[i] != (ids[i-1] + 1)
puts "My seat is #{ids[i] - 1}"
break
end
end

2043
day06/input Normal file

File diff suppressed because it is too large Load Diff

15
day06/input.sample Normal file
View File

@ -0,0 +1,15 @@
abc
a
b
c
ab
ac
a
a
a
a
b

10
day06/solution01.rb Executable file
View File

@ -0,0 +1,10 @@
#!/bin/env ruby
text = File.read('./input').split("\n\n")
text.map! do |t|
t.delete("\n").split('').uniq.reduce(:+)
end
size = text.map { |t| t.length }.reduce(:+)
p size

17
day06/solution02.rb Executable file
View File

@ -0,0 +1,17 @@
#!/bin/env ruby
groups = Hash.new
text = File.read('./input').strip.split("\n\n")
people = text.map { |t| t.count("\n") + 1 }
text.map!.with_index do |t, i|
t.delete!("\n")
t.each_char { |c| t.delete!(c) if t.count(c) != people[i] }
t.split('').uniq.reduce(:+)
end
text.compact!
size = text.map { |t| t.length }.reduce(:+)
p size