def day02_02(): """Run part 2 of Day 1's code""" path = "./input/02/input.txt" common_letters = find_similar_boxids(file_to_str_array(path)) print(f"Similar Characters: {common_letters}")
def test_run_6(self): mygame = Conway3D(file_to_str_array('tests/day17_testdata.txt')) result=mygame.run(6) assert result == 112
def day06_01(): """Run part 1 of Day 06's code""" path = "./input/06/input.txt" result = count_uniq_questions(file_to_str_array(path)) print(f'0601: The Sum of questions answer is: {result}')
def day08_01(): """Run part 1 of Day 08's code""" path = "./input/08/input.txt" mybootcode = BootCode(file_to_str_array(path)) result = mybootcode.run() print(f'0801: Accumulator value on looping: {result}')
def day10_02(): """Run part 2 of Day 10's code""" path = "./input/10/input.txt" result = number_combinations(file_to_str_array(path)) print(f'1002: The number of different ways we can power our laptop is: {result}')
def test_init_print(self): expected = 25 testnavcomp = NavComp(file_to_str_array('tests/day12_testdata.txt')) result = testnavcomp.dist_from_origin() assert expected == result
def day19_01(): """Run part 1 of Day 19's code""" path = "./input/19/input.txt" mycomp = RegExpComputer(file_to_str_array(path)) result = mycomp.match() print(f'1901: Number of messages that match: {result}')
def test_match(self): testdata = 'tests/day19_testdata2.txt' mycomp = RegExpComputerRecursive(file_to_str_array(testdata)) result = mycomp.match() assert result == 12
def day03_01(): """Run part 1 of Day 3's code""" path = "./input/03/input.txt" myrun=ToboganRun(file_to_str_array(path)) print(f'0301: Number of Trees Intercepted: {myrun.tree_count()}')
def day16_01(): """Run part 1 of Day 16's code""" path = "./input/16/input.txt" mytickets = Tickets(file_to_str_array(path)) result = mytickets.ticket_scanning_error_rate() print(f'1601: Ticket scanning error rate is: {result}')
def day12_02(): """Run part 2 of Day 12's code""" path = "./input/12/input.txt" testnavcomp = NavCompPart2(file_to_str_array(path)) result = testnavcomp.dist_from_origin() print(f'1202: Ship distance from origin using waypoints: {result}')
def day12_01(): """Run part 1 of Day 12's code""" path = "./input/12/input.txt" testnavcomp = NavComp(file_to_str_array(path)) result = testnavcomp.dist_from_origin() print(f'1201: Ship distance from origin: {result}')
def test_run_1_4D(self): my4dgame = Conway4D(file_to_str_array('tests/day17_testdata.txt')) result = my4dgame.run(1) print(str(my4dgame)) assert result == 29
def test_read_data_recursive(self): testdata = 'tests/day19_testdata2.txt' mycomp = RegExpComputerRecursive(file_to_str_array(testdata)) assert (8, 11) == mycomp.rules[0] assert 'bbabbbbaabaabba' in mycomp.messages
def day18_01(): """Run part 1 of Day 18's code""" path = "./input/18/input.txt" result=sum([FunnyMath(inputeqn).run() for inputeqn in file_to_str_array(path)]) print(f'1801: Sum of all problems in homework: {result}')
def test_read_data(self): testdata = 'tests/day19_testdata.txt' mycomp = RegExpComputer(file_to_str_array(testdata)) assert (4, 1, 5) == mycomp.rules[0] assert 'aaaabbb' in mycomp.messages
def day18_02(): """Run part 2 of Day 18's code""" path = "./input/18/input.txt" result=sum([FunnyMath2(inputeqn).run() for inputeqn in file_to_str_array(path)]) print(f'1802: Sum of all problems in homework with addition precedence: {result}')
def day10_01(): """Run part 1 of Day 10's code""" path = "./input/10/input.txt" result = jolt_diff_dist(file_to_str_array(path)) print(f'1001: The product of 1 and 3 adapter differences is: {result}')
def processinputfile(self): self.input = file_to_str_array(self.inputfile)
def __init__(self, inputfile): self.inputdata = file_to_str_array(inputfile) self.read_rows() self.read_cols(self.rows)
def test_01(self): expected=6 testinput=file_to_str_array("tests/day06_testinput.txt") result=count_all_answered_questions(testinput) assert result== expected
def test_turnright_part2(self): expected = 286 testnavcomp = NavCompPart2( file_to_str_array('tests/day12_testdata.txt')) result = testnavcomp.dist_from_origin() assert result == expected
def test_(self): expected=11 testinput=file_to_str_array("tests/day06_testinput.txt") print(testinput) result=count_uniq_questions(testinput) assert result == expected
def day06_02(): """Run part 2 of Day 06's code""" path = "./input/06/input.txt" result = count_all_answered_questions(file_to_str_array(path)) print(f'0602: Sum of questions answered by all in the group: {result}')
def test_bags_in_our_bag2(self): testinput = file_to_str_array("tests/day07_testdata2.txt") mydict = build_dict(testinput) our_bag = {'shiny gold': 1} result = bags_in_our_bag(our_bag, mydict) assert result == 126
def day02_01(): """Run part 1 of Day 2's code""" path = "./input/02/input.txt" final_checksum = checksum_multiple_labels(file_to_str_array(path)) print(f"final checksum: {final_checksum}")
def test_build_dict(self): testinput = file_to_str_array("tests/day07_testdata.txt") mydict = build_dict(testinput) assert mydict['dotted black'] == {} assert mydict['light red']['bright white'] == 1
def __init__(self,inputdata): ''' Initialise the computer and read in the instructions''' self.mask='' self.mem=defaultdict(int) self.inputdata=file_to_str_array(inputdata) self.intsize=36
def test_count_neighbours(self): mygame = Conway3D(file_to_str_array('tests/day17_testdata.txt')) result=mygame.count_occupied((1,1,0)) assert result == 5