from day_12_functions import find_mathattan_distance_for_planned_instructions, find_mathattan_distance_for_travelled_instructions from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 25 == find_mathattan_distance_for_planned_instructions( "test_input.txt"), 12, 1)) print( output_result( find_mathattan_distance_for_planned_instructions("input.txt"), 12, 1)) # Part 2 print( output_test_result( 286 == find_mathattan_distance_for_travelled_instructions( "test_input.txt"), 12, 2)) print( output_result( find_mathattan_distance_for_travelled_instructions("input.txt"), 12, 2))
from day_6_functions import get_sum_of_forms_yes_answers, get_sum_of_groups_common_yes_answers from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 11 == get_sum_of_forms_yes_answers("test_input.txt"), 6, 1)) print(output_result(get_sum_of_forms_yes_answers("input.txt"), 6, 1)) # Part 2 print(get_sum_of_groups_common_yes_answers("test_input.txt")) print( output_test_result( 6 == get_sum_of_groups_common_yes_answers("test_input.txt"), 6, 2)) print( output_result(get_sum_of_groups_common_yes_answers("input.txt"), 6, 2))
from day_1_functions import get_multiple_of_2_nr_that_sum_2020, get_multiple_of_3_nr_that_sum_2020 from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 514579 == get_multiple_of_2_nr_that_sum_2020('test_input.txt'), 1, 1)) print(output_result(get_multiple_of_2_nr_that_sum_2020('input.txt'), 1, 1)) # Part 2 print( output_test_result( 241861950 == get_multiple_of_3_nr_that_sum_2020('test_input.txt'), 1, 2)) print(output_result(get_multiple_of_3_nr_that_sum_2020('input.txt'), 1, 2))
from day_10_functions import calculate_difference_multiplication, get_all_adapter_combinations from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 35 == calculate_difference_multiplication("test_input.txt"), 10, 1)) print( output_test_result( 220 == calculate_difference_multiplication("test_input_2.txt"), 10, 1)) print( output_result(calculate_difference_multiplication("input.txt"), 10, 1)) # Part 2 print( output_test_result(8 == get_all_adapter_combinations("test_input.txt"), 10, 2)) print( output_test_result( 19208 == get_all_adapter_combinations("test_input_2.txt"), 10, 2)) print(output_result(get_all_adapter_combinations("input.txt"), 10, 2))
from day_19_functions import find_total_of_messages_that_match_rule_0, section_2_function from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 2 == find_total_of_messages_that_match_rule_0("test_input.txt"), 19, 1)) print( output_result(find_total_of_messages_that_match_rule_0("input.txt"), 19, 1)) # Part 2 print( output_test_result('result' == section_2_function("test_input.txt"), 19, 2)) print(output_result(section_2_function("input.txt"), 19, 2))
from day_18_functions import solve_homework_problems_equal_precendence, solve_homework_problems_addition_precendence from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 71 == solve_homework_problems_equal_precendence("test_input.txt"), 18, 1.1)) print( output_test_result( 51 == solve_homework_problems_equal_precendence("test_input1.txt"), 18, 1.11)) print( output_test_result( 26 == solve_homework_problems_equal_precendence("test_input2.txt"), 18, 1.2)) print( output_test_result( 437 == solve_homework_problems_equal_precendence( "test_input3.txt"), 18, 1.3)) print( output_test_result( 12240 == solve_homework_problems_equal_precendence( "test_input4.txt"), 18, 1.4)) print( output_test_result( 13632 == solve_homework_problems_equal_precendence( "test_input5.txt"), 18, 1.5)) print( output_result(solve_homework_problems_equal_precendence("input.txt"),
from day_14_functions import sum_program_memory_values_after_running, sum_memory_values_after_running_memory_decoder from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 165 == sum_program_memory_values_after_running("test_input.txt"), 14, 1)) print( output_result(sum_program_memory_values_after_running("input.txt"), 14, 1)) # Part 2 print( output_test_result( 208 == sum_memory_values_after_running_memory_decoder( "test_input2.txt"), 14, 2)) print( output_result( sum_memory_values_after_running_memory_decoder("input.txt"), 14, 2))
from day_2_functions import find_correct_passwords_from_file from helpers.helpers import output_result, output_test_result if __name__ == "__main__": # Part 1 print( output_test_result( 2 == find_correct_passwords_from_file("test_input.txt", type="count"), 2, 1)) print( output_result( find_correct_passwords_from_file("input.txt", type="count"), 2, 1)) # Part 2 print( output_test_result( 1 == find_correct_passwords_from_file("test_input.txt", type="position"), 2, 2)) print( output_result( find_correct_passwords_from_file("input.txt", type="position"), 2, 2))
from day_17_functions import get_count_of_active_cubes_after_6_runs, section_2_function from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 112 == get_count_of_active_cubes_after_6_runs("test_input.txt"), 17, 1)) print( output_result(get_count_of_active_cubes_after_6_runs("input.txt"), 17, 1)) # Part 2 print( output_test_result(848 == section_2_function("test_input.txt"), 17, 2)) print(output_result(section_2_function("input.txt"), 17, 2))
from day_11_functions import count_occupied_seats, count_again_occupied_seats from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result(37 == count_occupied_seats("test_input.txt"), 11, 1)) print(output_result(count_occupied_seats("input.txt"), 11, 1)) # Part 2 print( output_test_result(26 == count_again_occupied_seats("test_input.txt"), 11, 2)) print(output_result(count_again_occupied_seats("input.txt"), 11, 2))
from day_13_functions import get_earliest_bus_id_multiplied_by_wait_minutes, \ get_earliest_timestamp_when_busses_depart_1_min_apart from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 295 == get_earliest_bus_id_multiplied_by_wait_minutes( "test_input.txt"), 13, 1)) print( output_result( get_earliest_bus_id_multiplied_by_wait_minutes("input.txt"), 13, 1)) # Part 2 print( output_test_result( 1068781 == get_earliest_timestamp_when_busses_depart_1_min_apart( "test_input.txt"), 13, 2)) print( output_result( get_earliest_timestamp_when_busses_depart_1_min_apart("input.txt"), 13, 2))
from day_9_functions import find_invalid_number, find_encryption_weakness from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result(127 == find_invalid_number("test_input.txt", 5), 9, 1)) print(output_result(find_invalid_number("input.txt", 25), 9, 1)) # Part 2 print( output_test_result(62 == find_encryption_weakness("test_input.txt", 5), 9, 2)) print(output_result(find_encryption_weakness("input.txt", 25), 9, 2))
from day_16_functions import get_sum_of_invalid_field_numbers, get_multiplied_departure_field_numbers_from_your_ticket, \ get_order_label_list from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 71 == get_sum_of_invalid_field_numbers("test_input.txt"), 16, 1)) print(output_result(get_sum_of_invalid_field_numbers("input.txt"), 16, 1)) # Part 2 print( output_test_result(['row', 'class', 'seat' ] == get_order_label_list("test_input.txt")[0], 16, 2.1)) print( output_test_result(['row', 'class', 'seat' ] == get_order_label_list("test_input2.txt")[0], 16, 2.2)) print( output_result( get_multiplied_departure_field_numbers_from_your_ticket( "input.txt"), 16, 2))
from day_7_functions import get_total_of_bags_that_fit_shiny_gold_bag, get_total_amount_of_bags_inside_shiny_bag from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result( 4 == get_total_of_bags_that_fit_shiny_gold_bag("test_input.txt"), 7, 1)) print( output_result(get_total_of_bags_that_fit_shiny_gold_bag("input.txt"), 7, 1)) # Part 2 print( output_test_result( 32 == get_total_amount_of_bags_inside_shiny_bag("test_input.txt"), 7, 2)) print( output_test_result( 126 == get_total_amount_of_bags_inside_shiny_bag( "test_input_2.txt"), 7, 2)) print( output_result(get_total_amount_of_bags_inside_shiny_bag("input.txt"), 7, 2))
from day_4_functions import validate_passports, secure_validate_passports from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print(output_test_result(2 == validate_passports("test_input.txt"), 4, 1)) print(output_result(validate_passports("input.txt"), 4, 1)) # Part 2 print( output_test_result( 0 == secure_validate_passports("test_input_invalid.txt"), 4, 2)) print( output_test_result( 0 < secure_validate_passports("test_input_valid.txt"), 4, 2)) print(output_result(secure_validate_passports("input.txt"), 4, 2))
from helpers.helpers import output_test_result, output_result from day_5_functions import get_boarding_passes, get_heighest_seat_id, find_seat if __name__ == "__main__": test_result = [[70, 7, 567], [14, 7, 119], [102, 4, 820]] # Part 1 print( output_test_result( test_result == get_boarding_passes("test_input.txt"), 5, 1)) print(output_result(get_heighest_seat_id("input.txt"), 5, 1)) # Part 2 print(output_result(find_seat("input.txt"), 5, 2))
from day_3_functions import get_encountered_trees_count, get_multiplication_of_trees_from_different_paths from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print( output_test_result(7 == get_encountered_trees_count("test_input.txt"), 3, 1)) print(output_result(get_encountered_trees_count("input.txt"), 3, 1)) # Part 2 print( output_test_result( 336 == get_multiplication_of_trees_from_different_paths( "test_input.txt"), 3, 2)) print( output_result( get_multiplication_of_trees_from_different_paths("input.txt"), 3, 2))
from day_8_functions import get_accumulator_value_from_boot_code, find_accumulator_value_in_fixed_system from helpers.helpers import output_test_result, output_result if __name__ == "__main__": # Part 1 print(output_test_result(5 == get_accumulator_value_from_boot_code("test_input.txt"), 8, 1)) print(output_result(get_accumulator_value_from_boot_code("input.txt"), 8, 1)) # Part 2 print(output_test_result(8 == find_accumulator_value_in_fixed_system("test_input.txt"), 8, 2)) print(output_result(find_accumulator_value_in_fixed_system("input.txt"), 8, 2))