Finish day 5 part 2

This commit is contained in:
Ethanell 2020-12-05 22:12:07 +01:00
parent 630612ffab
commit fdc1e7ef02
2 changed files with 777 additions and 0 deletions

View file

@ -0,0 +1,20 @@
seats = open("input.txt").read().split("\n")[:-1]
plane = [[i*8+j for j in range(8)] for i in range(128)]
taken = []
for seat in seats:
p = plane
for h in seat[:7]:
if h == "F":
p = p[:len(p)//2]
else:
p = p[len(p)//2:]
p = p[0]
for h in seat[7:]:
if h == "L":
p = p[:len(p)//2]
else:
p = p[len(p)//2:]
taken.append(p[0])
print(list(filter(lambda x: x not in taken and x+1 in taken and x-1 in taken, range(1024)))[0])

757
2020/day 5/P2/input.txt Normal file
View file

@ -0,0 +1,757 @@
FBBBBBBLRR
FFFBFFFLLR
FFBBBBBRRL
BFFBFFBRLL
BFBFBBFLLR
FBFBBFBLLL
FBFBBBFRRR
FBFFBBBLRR
FBFBBBBRLL
FFFBBFBLLR
FBFBFFFRRL
FFBBBFFLLR
BFFFFFBRRR
FBFFFFFLLR
FFFBBFFRRL
FBBBBBBRRR
FBBFFBBRLR
FBFBFBBRLL
BFFBBFBLLR
FBFFFFBLLR
FFFBFFBRLL
BFBBBBBLRL
BFFBFBFLRR
FFBBFFBRLR
BFFFFBFLRR
BFFFFBBLRR
FBBFFFBLLL
FFBFBFBLRR
FBFBFBBRRL
FFBFBBBLRR
BFFBFFFRRL
BFBFBFBRRL
BFFBBBFRLR
BFBBFBFLLR
FBFBBBFLRL
FBFFBBBRLL
BFFFFBBLRL
BFBBBBBRRR
BFFBFFFLLL
BBFFFBFRRL
BFFBFBBRLL
FFBBBBFLRL
BFFFFFFRLL
BFFFBFBLRL
FFBBFBBLRL
BFBBBBBRLL
FBFFBBBLLL
BFBBFBFLLL
BFFBBBBRRL
FFFBFFBRLR
BFFBFFFRRR
FFBBBBFLLR
FBFBBBFRRL
BFBBFBBRLR
FBFBFFFRRR
BBFFFFBRLL
FBFFBFFRLL
BFBFBBBRRL
FFFBFBBLLL
FBBFBBFLLL
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