def first(): pattern = (0, 1, 0, -1) print(f"(test) {fft('12345678', pattern, 8, 4)}") print(f"(test) {fft('80871224585914546619083218645595', pattern, 8, 100)[:8]}") print(f"(test) {fft('19617804207202209144916044189917', pattern, 8, 100)[:8]}") sequence = str(DataAnalyzer.load("2019day16.txt")[0]) print(f"(16.1) {fft(sequence, pattern, 8, 100)[:8]}")
def second(): pattern = (0, 1, 0, -1) print(f"(16.2 test) 98765432109876543210, 7 => {'98765432109876543210'[7:7+8]}") sequence = str(DataAnalyzer.load("2019day16.txt")[0]) offset = int(sequence[:7]) sequence += 10000 * sequence signal = fft(sequence, pattern, 8, 10000) print(f"(16.2) {signal[offset:offset+8]}")
def second(): values = DataAnalyzer.load("2019day1.txt") total = 0 for num in values: running = int(math.floor(int(num) / 3) - 2) while running > 0: total += running running = int(math.floor(int(running) / 3) - 2) print("(1.2) total fuel: {:d}".format(total))
def second(): data = [ "1-3 a: abcde", "1-3 b: cdefg", "2-9 c: ccccccccc" ] print("(2.2.0) test valid passwords is {:d}".format(index_check(data))) data = DataAnalyzer.load("2020day2.txt") print("(2.2) test valid passwords is {:d}".format(index_check(data)))
def first(): values = DataAnalyzer.load("2019day1.txt") total = 0 for num in [12, 14, 1969, 100756]: print("(test): {:d}".format(calc(num))) for num in values: total += calc(num) print("(1.1) total fuel: {:d}".format(total))
def first(): data = [ "1-3 a: abcde", "1-3 b: cdefg", "2-9 c: ccccccccc" ] print("(2.1.0) test valid passwords is {:d}".format(bound_check(data))) data = DataAnalyzer.load("2020day2.txt") print("(2.1) valid passwords is {:}".format(bound_check(data)))
def second(): values = DataAnalyzer.load("2019day14.txt")
def first(): values = [i.strip() for i in DataAnalyzer.load("2019day22.txt")] deck = run_instructions(values, [x for x in range(10007)]) print(f"(22.1) Position of cards 2019 is {deck.index(2019)}")
def second(): values = [i.strip() for i in DataAnalyzer.load("2019day22.txt")] deck = repeat_instructions(values) print(f"(22.1) Position of cards 2019 is {deck.index(2020)}")