diff --git a/test/day5.in b/test/day5.in new file mode 100644 index 0000000..bf62729 --- /dev/null +++ b/test/day5.in @@ -0,0 +1,908 @@ +FBFBFBFRRR +BBFBFBFRRR +BFFFFFBRRR +BFFFFBBLRR +BBFFBBFLRR +BBFFFFBRLL +BBFBFFBLLL +FBFFBFBRLR +FBFFBFBLLR +FBFBBFFLLR +BFBFBBFLLL +FFFBFFBRLR +FFFBBBFRRR +BBFFFFFLRL +FFFFBBFRLR +BBBFFFFRLL +BBFFBFFRLL +BFBFFFBLRR +FFBBBFFRRL +FBFFFFFLRL +FBFFBBBRRR +BFFFBFFLRR +FFFBBBBLLR +BFFBFFFLLL +BFFBBBFLRR +FBFBBFFRRR +BBBFFBFRRL +BFBBBFFRRR +FFFBFBBLRL +BBFFFBBRRR +FFFBBFFRLR +BFFFFFBRRL +BFFFBBFRLR +FBBBBBBLLR +BFFBBBBLLL +FFFFBBFLRL +FBFBBFBLRR +FBBBBFBLRL +FBBBFFFRLL +BBFBFBBLRL +FBFFBFFRLL +FFBFBFFLRL +BFBFBBBLRR +FFBFFBFLRR +BFBFFBFLRR +BFFBFFFLLR +BBBFFFBLRR +FBFBBBFRRL +FBBFFFFLRR +FFBBBBFLRL +FFFFBBBLRL +FBBFFFBRRR +FBBBFFFRRR +FBFBBFFRLL +FFBBBBFLLR +FBBFFBBRRL +BBFBFFBLLR +FFBBBBFRLR +BBFBFFFLRR +FFFBFBFRLR +BFBBFBFLLR +BFBBBFFRRL +FFBBBFBRLR +BFBFFFFLRL +FBBFBFFRRR +BBFBFBBLLR +BFFBFBBRRL +FFFBFFFRRL +BFFFBFFRRR +FFBBFBBLLL +FBBFFBFLLR +BFBBBBFLRL +BFBFFFFRRL +BBBFBFFRRL +FFBFBFBLLL +FBBBBFBRRR +BFFFBBBLRR +FBFFFBFRLR +BFFBFFFRLL +BBBFBBFLLR +BFBBBFBLLL +BFBFFBFRLR +BBFFFFFRRR +FBBBBFBLLR +BFBFFBBLLR +FBFBFFFLLR +BBFF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BFBFBBLLL +FFBBBBBRLL +BBFFBFFLRR +BBBFBBFRRR +FBBBFBBRLR +FFFFBFBRLR +FFFFBBBLRR +FBFBFFFRLR +BBFFBBFRRL +BFFFBBFRRR +FFBBFBBRRL +FFFBBFFLLL +BBBFFBBRLL +FBBBBBFRLL +BFFBFBFLRL +BBFBBBBRLR +FFFBBFBRLR +FBFBFFFLRR +BFFFFBBLLR +BBBFFBFLLR +BBFBBFFRRR +BFFBFBFLRR +FBFFFBFLLL +BFFFFBFLLL +BBBFBFFRLL +BBFFBFFLLL +BBFBBFFLLL +BFFFBFFRLR +BFFBBBFLLR +FFFFBBBLLL +BFFFBFBLRR +BBBFBFBLLL +FBFFBFBLLL +FBBFBBFLRL +FBBBBFBRLR +BBFBBBBRRL +BFBBBFFLRL +FFBFFBFLRL +FFBFFBBLLL +BFBFBBBLLL +FBBFFFBRRL +BFFBFBBRRR +BFFFFFFRRL +FBBFFBBLLL +BBFBFBFLRR +FFBFFFFLLR +FBFBBFFLRL +FBBFFFFRLL +FBBBBFFLLR +BBBFFBBRLR +FBFFFFBRRL +FFFFBFBRRL +BFFFBFBRLR +BFBBBBFLRR +BBBFFBFLLL +FBFBFBBLLR +FFBFBFBLRR +BBFFBBFRLL +BFBFBBBLRL +BFFFBBBRLL +FFBBBFBLRL +FBFFFBBLRL +FBBFFBFRLL +FFFBFBBRLR +FBBBFBBLRR +FBBFFBBLRR +BFBBBBBRRR +BFBBFBFRRR +BFBFFBFRRL +FFBFBBBRLL +BFBBBBBLRL +BFFBBBFLLL +FFBBBFFLRL +FFBFFBBLLR +FBFFFBFLRL +FBBFBFFLRR +FBBBBBFRRL diff --git a/test/day5.krk b/test/day5.krk new file mode 100644 index 0000000..0c3a177 --- /dev/null +++ b/test/day5.krk @@ -0,0 +1,77 @@ +from fileio import open + +let f = open('test/day5.in') +let lines = f.read().split('\n')[:-1] + +def process_row(seat): + let bottom = 0 + let top = 128 + let size = 128 + for c in seat[:7]: + if c == 'F': + top -= size / 2 + else if c == 'B': + bottom += size / 2 + size = size / 2 + return bottom + +def process_seat(seat): + let bottom = 0 + let top = 8 + let size = 8 + for c in seat[7:]: + if c == 'L': + top -= size / 2 + else if c == 'R': + bottom += size / 2 + size = size / 2 + return bottom + +print process_row("FBFBBFFRLR") # 44 +print process_seat("FBFBBFFRLR") # 5 + +def seat_id(seat): + let row = process_row(seat) + seat = process_seat(seat) + return row * 8 + seat + +let top = -1 +for l in lines: + let i = seat_id(l) + if i > top: + top = i + +print top # Answer to part 1, should be 953 + +let taken = {} + +for l in lines: + let i = seat_id(l) + taken[i] = 1 + +def min(iter): + let l # Silly way to get the first value of an iterable that doesn't do [] + for v in iter: + l = v + break + for v in iter: + if v < l: + l = v + return l + +def max(iter): + let l # Silly way to get the first value of an iterable that doesn't do [] + for v in iter: + l = v + break + for v in iter: + if v > l: + l = v + return l + +print "---" +for i in range(min(taken.keys()), max(taken.keys())): + if (i - 1) in taken and (i + 1) in taken and i not in taken: + print i + +# Should print once, 615