├── .github └── workflows │ ├── publish.yml │ └── test.yml ├── LICENSE ├── README.md ├── aoc_wim ├── __init__.py ├── aoc2015 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q24.py │ └── q25.py ├── aoc2016 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q05_single_core.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q14.py │ ├── q14_single_core.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q24.py │ └── q25.py ├── aoc2017 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q08_crazy.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q12_quadratic.py │ ├── q13.py │ ├── q14.py │ ├── q15.py │ ├── q15_numba.py │ ├── q15_slow.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q24.py │ └── q25.py ├── aoc2018 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q23b_pulp.py │ ├── q23b_z3.py │ ├── q24.py │ └── q25.py ├── aoc2019 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q24.py │ └── q25.py ├── aoc2020 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q10_dp.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q13_sync.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q17_sans_scipy.py │ ├── q18.py │ ├── q19.py │ ├── q19_lark.py │ ├── q19_recursion.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q24.py │ ├── q24_scipy.py │ └── q25.py ├── aoc2021 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q22_slow.py │ ├── q23.py │ ├── q24.py │ └── q25.py ├── aoc2022 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q13_rich.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q23_sans_scipy.py │ ├── q24.py │ └── q25.py ├── aoc2023 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q13_numpy.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q24.py │ └── q25.py ├── aoc2024 │ ├── __init__.py │ ├── q01.py │ ├── q02.py │ ├── q03.py │ ├── q04.py │ ├── q05.py │ ├── q06.py │ ├── q07.py │ ├── q08.py │ ├── q09.py │ ├── q10.py │ ├── q11.py │ ├── q12.py │ ├── q13.py │ ├── q14.py │ ├── q15.py │ ├── q16.py │ ├── q17.py │ ├── q17_decompiled.py │ ├── q18.py │ ├── q19.py │ ├── q20.py │ ├── q21.py │ ├── q22.py │ ├── q23.py │ ├── q24.py │ └── q25.py ├── autoparse.py ├── cli.py ├── ocr.py ├── search.py ├── stuff.py ├── util.py └── zgrid.py ├── pyproject.toml └── tests ├── 2015 ├── 10 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ └── 5.txt ├── 11 │ ├── 0.txt │ └── 1.slow.txt ├── 12 │ ├── 0.txt │ ├── 1.txt │ ├── 10.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ ├── 8.txt │ └── 9.txt ├── 13 │ └── 0.txt ├── 14 │ └── 0.txt ├── 15 │ └── 0.txt ├── 17 │ └── 0.txt ├── 18 │ ├── 0.txt │ └── 1.txt ├── 19 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 23 │ └── 0.txt ├── 24 │ └── 0.txt ├── 25 │ ├── 0.row1_col1.txt │ ├── 1.row1_col2.txt │ ├── 10.row2_col5.txt │ ├── 11.row2_col6.txt │ ├── 12.row3_col1.txt │ ├── 13.row3_col2.txt │ ├── 14.row3_col3.txt │ ├── 15.row3_col4.txt │ ├── 16.row3_col5.txt │ ├── 17.row3_col6.txt │ ├── 18.row4_col1.txt │ ├── 19.row4_col2.txt │ ├── 2.row1_col3.txt │ ├── 20.row4_col3.txt │ ├── 21.row4_col4.txt │ ├── 22.row4_col5.txt │ ├── 23.row4_col6.txt │ ├── 24.row5_col1.txt │ ├── 25.row5_col2.txt │ ├── 26.row5_col3.txt │ ├── 27.row5_col4.txt │ ├── 28.row5_col5.txt │ ├── 29.row5_col6.txt │ ├── 3.row1_col4.txt │ ├── 30.row6_col1.txt │ ├── 31.row6_col2.txt │ ├── 32.row6_col3.txt │ ├── 33.row6_col4.txt │ ├── 34.row6_col5.txt │ ├── 35.row6_col6.txt │ ├── 4.row1_col5.txt │ ├── 5.row1_col6.txt │ ├── 6.row2_col1.txt │ ├── 7.row2_col2.txt │ ├── 8.row2_col3.txt │ └── 9.row2_col4.txt ├── 01 │ ├── 0.txt │ ├── 1.txt │ ├── 10.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ ├── 8.txt │ └── 9.txt ├── 02 │ ├── 0.txt │ └── 1.txt ├── 03 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 04 │ ├── 0.slow.txt │ └── 1.slow.txt ├── 05 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ └── 8.txt ├── 06 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 07 │ ├── 0.d.txt │ ├── 1.e.txt │ ├── 2.f.txt │ ├── 3.g.txt │ ├── 4.h.txt │ ├── 5.i.txt │ ├── 6.x.txt │ └── 7.y.txt ├── 08 │ └── 0.txt ├── 09 │ └── 0.txt ├── test_10_elves_look_elves_say.py ├── test_11_corporate_policy.py ├── test_20_infinite_elves_and_infinite_houses.py ├── test_21_rpg_simulator_20xx.py └── test_23_opening_the_turing_lock.py ├── 2016 ├── 10 │ └── 0.txt ├── 11 │ └── 0.txt ├── 12 │ └── 0.txt ├── 13 │ └── 0.txt ├── 14 │ └── 0.slow.txt ├── 15 │ └── 0.txt ├── 16 │ ├── 0.txt │ └── 1.txt ├── 17 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 18 │ ├── 0.txt │ └── 1.txt ├── 19 │ └── 0.txt ├── 20 │ └── 0.txt ├── 21 │ └── 0.txt ├── 22 │ └── 0.txt ├── 23 │ └── 0.txt ├── 24 │ └── 0.txt ├── 01 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 02 │ └── 0.txt ├── 03 │ └── 0.txt ├── 04 │ └── 0.txt ├── 05 │ └── 0.slow.txt ├── 06 │ └── 0.txt ├── 07 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ └── 7.txt ├── 08 │ └── 0.txt ├── 09 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ ├── reddit.1.txt │ ├── reddit.2.txt │ ├── topaz.1.txt │ ├── topaz.2.txt │ └── wim.txt ├── test_04_security_through_obscurity.py ├── test_08_two_factor_authentication.py ├── test_13_a_maze_of_twisty_little_cubicles.py ├── test_16_dragon_checksum.py └── test_17_two_steps_forward.py ├── 2017 ├── 10 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 11 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 12 │ └── 0.txt ├── 13 │ └── 0.txt ├── 14 │ └── 0.slow.txt ├── 15 │ └── 0.slow.txt ├── 16 │ └── 0.txt ├── 17 │ └── 0.txt ├── 18 │ ├── 0.txt │ └── 1.txt ├── 19 │ └── 0.txt ├── 20 │ ├── 0.txt │ └── 1.txt ├── 21 │ └── 0.txt ├── 22 │ ├── 0.txt │ ├── 1.txt │ ├── 2.slow.txt │ └── 3.txt ├── 24 │ └── 0.txt ├── 25 │ └── 0.txt ├── 01 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ └── 8.txt ├── 02 │ ├── 0.txt │ └── 1.txt ├── 03 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 04 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ └── 7.txt ├── 05 │ └── 0.txt ├── 06 │ └── 0.txt ├── 07 │ └── 0.txt ├── 08 │ └── 0.txt ├── 09 │ ├── 0.txt │ ├── 1.txt │ ├── 10.txt │ ├── 11.txt │ ├── 12.txt │ ├── 13.txt │ ├── 14.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ ├── 8.txt │ └── 9.txt ├── test_03_spiral_memory.py └── test_05_a_maze_of_twisty_trampolines_all_alike.py ├── 2018 ├── 10 │ └── 0.txt ├── 11 │ ├── 0.txt │ └── 1.txt ├── 12 │ └── 0.txt ├── 13 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 14 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ └── 7.txt ├── 15 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ └── 5.txt ├── 16 │ └── 0.txt ├── 17 │ └── 0.txt ├── 18 │ └── 0.txt ├── 19 │ └── 0.txt ├── 20 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── wim.1.txt │ ├── wim.2.txt │ ├── wim.3.txt │ ├── wim.4.txt │ ├── wim.5.txt │ └── wim.6.txt ├── 22 │ └── 0.txt ├── 23 │ ├── 0.txt │ ├── 1.txt │ └── jonathanpaulson.broken.txt ├── 24 │ └── 0.txt ├── 25 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 01 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ └── 7.txt ├── 02 │ ├── 0.txt │ └── 1.txt ├── 03 │ └── 0.txt ├── 04 │ └── 0.txt ├── 05 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 06 │ └── 0.txt ├── 07 │ └── 0.txt ├── 08 │ └── 0.txt ├── 09 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ └── 5.txt ├── test_05_alchemical_reduction.py ├── test_11_chronal_charge.py └── test_16_chronal_classification.py ├── 2019 ├── 10 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 12 │ ├── 0.txt │ └── 1.txt ├── 14 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 16 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ ├── 8.txt │ └── 9.txt ├── 18 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ ├── 8.txt │ ├── fizbin.txt │ └── swilkoBaggins.broken.txt ├── 20 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 24 │ └── 0.txt ├── 01 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 03 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 04 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ └── 5.txt ├── 05 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ └── 6.txt ├── 06 │ ├── 0.txt │ └── 1.txt ├── 07 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 08 │ ├── 0.txt │ └── 1.txt ├── 09 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── test_02_1202_program_alarm.py ├── test_05_sunny_with_a_chance_of_asteroids.py ├── test_10_monitoring_station.py ├── test_17_set_and_forget.py └── test_19_tractor_beam.py ├── 2020 ├── 10 │ ├── 0.txt │ └── 1.txt ├── 11 │ └── 0.txt ├── 12 │ └── 0.txt ├── 13 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ └── 5.txt ├── 14 │ ├── 0.txt │ └── 1.txt ├── 15 │ ├── 0.slow.txt │ ├── 1.slow.txt │ ├── 2.slow.txt │ ├── 3.slow.txt │ ├── 4.slow.txt │ ├── 5.slow.txt │ └── 6.slow.txt ├── 16 │ ├── 0.txt │ └── 1.txt ├── 17 │ └── 0.txt ├── 18 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ └── 5.txt ├── 19 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── jonathanpaulson.broken.txt ├── 20 │ └── 0.txt ├── 21 │ └── 0.txt ├── 22 │ └── 0.txt ├── 23 │ └── 0.slow.txt ├── 24 │ └── 0.slow.txt ├── 25 │ └── 0.txt ├── 01 │ └── 0.txt ├── 02 │ └── 0.txt ├── 03 │ └── 0.txt ├── 04 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 05 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── 06 │ ├── 0.txt │ └── 1.txt ├── 07 │ ├── 0.txt │ └── 1.txt ├── 08 │ └── 0.txt ├── 09 │ ├── 0.txt │ └── jwolf.txt ├── test_16_ticket_translation.py └── test_22_crab_combat.py ├── 2021 ├── 10 │ └── 0.txt ├── 11 │ └── 0.txt ├── 12 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 13 │ └── 0.txt ├── 14 │ └── 0.txt ├── 15 │ └── 0.txt ├── 16 │ ├── 0.txt │ ├── 1.txt │ ├── 10.txt │ ├── 11.txt │ ├── 12.txt │ ├── 13.txt │ ├── 14.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.txt │ ├── 6.txt │ ├── 7.txt │ ├── 8.txt │ └── 9.txt ├── 17 │ └── 0.txt ├── 18 │ └── 0.txt ├── 19 │ └── 0.txt ├── 20 │ └── 0.txt ├── 21 │ └── 0.txt ├── 22 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 23 │ └── 0.slow.txt ├── 25 │ └── 0.txt ├── 01 │ └── 0.txt ├── 02 │ └── 0.txt ├── 03 │ └── 0.txt ├── 04 │ └── 0.txt ├── 05 │ └── 0.txt ├── 06 │ └── 0.txt ├── 07 │ └── 0.txt ├── 08 │ ├── 0.txt │ └── 1.txt ├── 09 │ └── 0.txt ├── test_10_syntax_scoring.py ├── test_18_snailfish.py └── test_24_arithmetic_logic_unit.py ├── 2022 ├── 10 │ └── 0.txt ├── 11 │ └── 0.txt ├── 12 │ └── 0.txt ├── 13 │ └── 0.txt ├── 14 │ └── 0.txt ├── 15 │ └── 0.txt ├── 16 │ └── 0.txt ├── 17 │ └── 0.txt ├── 18 │ ├── 0.txt │ └── 1.txt ├── 19 │ └── 0.txt ├── 20 │ └── 0.txt ├── 21 │ └── 0.txt ├── 22 │ └── 0.txt ├── 23 │ ├── 0.txt │ └── 1.txt ├── 24 │ └── 0.txt ├── 25 │ └── 0.txt ├── 01 │ └── 0.txt ├── 02 │ └── 0.txt ├── 03 │ └── 0.txt ├── 04 │ └── 0.txt ├── 05 │ └── 0.txt ├── 06 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 07 │ └── 0.txt ├── 08 │ └── 0.txt └── 09 │ ├── 0.txt │ └── 1.txt ├── 2023 ├── 10 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ └── 5.txt ├── 11 │ └── 0.txt ├── 12 │ └── 0.txt ├── 13 │ └── 0.txt ├── 14 │ └── 0.txt ├── 15 │ └── 0.txt ├── 16 │ └── 0.txt ├── 17 │ ├── 0.txt │ ├── 1.txt │ ├── IsatisCrucifer.txt │ └── gabrielchl.txt ├── 18 │ └── 0.txt ├── 19 │ └── 0.txt ├── 20 │ ├── 0.txt │ └── 1.txt ├── 21 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ ├── 4.txt │ ├── 5.slow.txt │ └── 6.slow.txt ├── 22 │ └── 0.txt ├── 23 │ └── 0.txt ├── 24 │ └── 0.txt ├── 25 │ └── 0.txt ├── 01 │ ├── 0.txt │ └── 1.txt ├── 02 │ └── 0.txt ├── 03 │ ├── 0.txt │ ├── Full-Mathematician-7.txt │ ├── IsatisCrucifer.txt │ ├── WorldOfSoap.txt │ ├── _Merxer_.txt │ ├── i_have_no_biscuits.1.txt │ ├── i_have_no_biscuits.2.txt │ ├── i_have_no_biscuits.3.txt │ └── musifter.txt ├── 04 │ └── 0.txt ├── 05 │ └── 0.txt ├── 06 │ └── 0.txt ├── 07 │ ├── 0.txt │ ├── LxsterGames.txt │ └── jwolf.txt ├── 08 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt └── 09 │ └── 0.txt ├── 2024 ├── 10 │ └── 0.txt ├── 11 │ └── 0.txt ├── 12 │ ├── 0.txt │ ├── 1.txt │ ├── 2.txt │ ├── 3.txt │ └── 4.txt ├── 13 │ └── 0.txt ├── 14 │ └── 0.txt ├── 15 │ ├── 0.txt │ └── 1.txt ├── 16 │ ├── 0.txt │ └── 1.txt ├── 17 │ ├── 0.txt │ └── 1.txt ├── 18 │ └── 0.txt ├── 19 │ └── 0.txt ├── 20 │ ├── 0.txt │ └── 1.txt ├── 21 │ └── 0.txt ├── 22 │ ├── 0.txt │ └── 1.txt ├── 23 │ └── 0.txt ├── 24 │ ├── 0.txt │ ├── 1.txt │ └── 2.txt ├── 25 │ └── 0.txt ├── 01 │ └── 0.txt ├── 02 │ └── 0.txt ├── 03 │ ├── 0.txt │ └── 1.txt ├── 04 │ └── 0.txt ├── 05 │ └── 0.txt ├── 06 │ └── 0.txt ├── 07 │ └── 0.txt ├── 08 │ ├── 0.txt │ └── 1.txt └── 09 │ └── 0.txt ├── conftest.py └── test_examples.py /LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2016 Wim Glenn 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wimglenn/advent-of-code-wim/d0f2404ef75921825b6a09295d0362d39ae94026/aoc_wim/aoc2015/__init__.py -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: Not Quite Lisp --- 3 | https://adventofcode.com/2015/day/1 4 | """ 5 | from aocd import data 6 | 7 | 8 | direction = {"(": +1, ")": -1} 9 | basement = None 10 | floor = 0 11 | for i, c in enumerate(data, 1): 12 | floor += direction[c] 13 | if basement is None and floor == -1: 14 | basement = i 15 | 16 | 17 | print("answer_a:", floor) 18 | print("answer_b:", basement) 19 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q03.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 3: Perfectly Spherical Houses in a Vacuum --- 3 | https://adventofcode.com/2015/day/3 4 | """ 5 | from aocd import data 6 | 7 | 8 | step = { 9 | "^": -1j, 10 | ">": 1, 11 | "v": 1j, 12 | "<": -1, 13 | } 14 | 15 | 16 | z = 0 17 | seen = {z} 18 | for c in data: 19 | z += step[c] 20 | seen |= {z} 21 | 22 | print("answer_a:", len(seen)) 23 | 24 | 25 | z = 0 26 | seen = {z} 27 | for c in data[0::2]: # santa 28 | z += step[c] 29 | seen |= {z} 30 | 31 | z = 0 32 | for c in data[1::2]: # robo-santa 33 | z += step[c] 34 | seen |= {z} 35 | 36 | print("answer_b:", len(seen)) 37 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q04.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 4: The Ideal Stocking Stuffer --- 3 | https://adventofcode.com/2015/day/4 4 | """ 5 | from _md5 import md5 6 | 7 | from aocd import data 8 | 9 | 10 | def mine(data, difficulty, start=0): 11 | secret_key = data.encode() 12 | prefix = "0" * difficulty 13 | h0 = md5(secret_key).copy 14 | i = start 15 | while True: 16 | i += 1 17 | hash_ = h0() 18 | hash_.update(b"%d" % i) 19 | if hash_.hexdigest().startswith(prefix): 20 | return i 21 | 22 | 23 | a = mine(data, difficulty=5) 24 | print("answer_a:", a) 25 | b = mine(data, difficulty=6, start=a - 1) 26 | print("answer_b:", b) 27 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q10.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 10: Elves Look, Elves Say --- 3 | https://adventofcode.com/2015/day/10 4 | """ 5 | from itertools import groupby 6 | 7 | from aocd import data 8 | from aocd import extra 9 | 10 | 11 | def look_and_say(s, n=1): 12 | for i in range(n): 13 | s = "".join([f"{len(list(group))}{key}" for key, group in groupby(s)]) 14 | return s 15 | 16 | 17 | n = extra.get("iterations", 40) 18 | a = look_and_say(data, n=n) 19 | print("answer_a:", len(a)) 20 | if not extra: 21 | b = look_and_say(a, n=50 - n) 22 | print("answer_b:", len(b)) 23 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q12.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 12: JSAbacusFramework.io --- 3 | https://adventofcode.com/2015/day/12 4 | """ 5 | import json 6 | import re 7 | 8 | from aocd import data 9 | 10 | 11 | def numbers(s): 12 | return re.findall(r"-?\d+", s) 13 | 14 | 15 | def rsum(data): 16 | match data: 17 | case int(): return data 18 | case list(): return sum(rsum(x) for x in data) 19 | case dict(): 20 | vals = list(data.values()) 21 | return 0 if "red" in vals else rsum(vals) 22 | case _: return 0 23 | 24 | 25 | print("answer_a:", sum(map(int, numbers(data)))) 26 | print("answer_b:", rsum(json.loads(data))) 27 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q17.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 17: No Such Thing as Too Much --- 3 | https://adventofcode.com/2015/day/17 4 | """ 5 | from aocd import data 6 | from aocd import extra 7 | 8 | from aoc_wim.stuff import subset_sum 9 | 10 | 11 | vals = [*map(int, data.split())] 12 | subsets = list(subset_sum(vals, extra.get("liters", 150))) 13 | print("answer_a:", len(subsets)) 14 | fewest = min(subsets, key=len) 15 | print("answer_b:", sum(len(s) == len(fewest) for s in subsets)) 16 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q20.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 20: Infinite Elves and Infinite Houses --- 3 | https://adventofcode.com/2015/day/20 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | 8 | 9 | A = np.zeros(1000000, dtype=int) 10 | B = A.copy() 11 | for i in range(1, 1000000): 12 | A[i::i] += i * 10 13 | B[i::i][:50] += i * 11 14 | 15 | print("answer_a:", np.argmax(A > int(data or 0))) 16 | print("answer_b:", np.argmax(B > int(data or 0))) 17 | -------------------------------------------------------------------------------- /aoc_wim/aoc2015/q25.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 25: Let It Snow --- 3 | https://adventofcode.com/2015/day/25 4 | """ 5 | from aocd import data 6 | 7 | 8 | words = data.split() 9 | row = int(words[-3].rstrip(",")) 10 | col = int(words[-1].rstrip(".")) 11 | 12 | 13 | def n(row, col): 14 | i = (row + col) * (row + col) + 2 - col - 3 * row 15 | return i // 2 16 | 17 | 18 | m = 252533 19 | d = 33554393 20 | i = n(row, col) 21 | code = 20151125 22 | for _ in range(1, i): 23 | code = m * code % d 24 | 25 | print("answer_a:", code) 26 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: No Time for a Taxicab --- 3 | https://adventofcode.com/2016/day/1 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.zgrid import manhattan_distance 8 | 9 | 10 | z = 0 11 | dz = -1j 12 | seen = {z} 13 | turns = {"R": 1j, "L": -1j} 14 | b = None 15 | for step in data.split(", "): 16 | turn, n_blocks = step[0], int(step[1:]) 17 | dz *= turns[turn] 18 | for block in range(n_blocks): 19 | z += dz 20 | if b is None and z in seen: 21 | b = manhattan_distance(z) 22 | seen.add(z) 23 | 24 | print("answer_a:", manhattan_distance(z)) 25 | print("answer_b:", b) 26 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q03.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 3: Squares With Three Sides --- 3 | https://adventofcode.com/2016/day/3 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | 8 | 9 | A = np.fromstring(data, sep=" ", dtype=int) 10 | R = A.reshape(-1, 3).T 11 | C = R.reshape(-1, 3).T 12 | 13 | for part, A in zip("ab", [R, C]): 14 | T = A[0] + A[1] > A[2] 15 | T &= A[0] + A[2] > A[1] 16 | T &= A[1] + A[2] > A[0] 17 | print(f"answer_{part}:", T.sum()) 18 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q06.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 6: Signals and Noise --- 3 | https://adventofcode.com/2016/day/6 4 | """ 5 | from collections import Counter 6 | 7 | from aocd import data 8 | 9 | counters = [Counter(x) for x in zip(*data.splitlines())] 10 | print("answer_a:", "".join([max(c, key=c.get) for c in counters])) 11 | print("answer_b:", "".join([min(c, key=c.get) for c in counters])) 12 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q12.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 12: Leonardo's Monorail --- 3 | https://adventofcode.com/2016/day/12 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.aoc2016 import AssembunnyComputer 8 | 9 | 10 | comp = AssembunnyComputer(data) 11 | comp.run() 12 | print("answer_a:", comp.reg["a"]) 13 | 14 | comp.__init__(data, c0=1) 15 | comp.run() 16 | print("answer_b:", comp.reg["a"]) 17 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q18.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 18: Like a Rogue --- 3 | https://adventofcode.com/2016/day/18 4 | """ 5 | from aocd import data 6 | from aocd import extra 7 | 8 | 9 | def generate_rows(row): 10 | """rule90: https://en.wikipedia.org/wiki/Rule_90""" 11 | idx = range(len(row)) 12 | while True: 13 | yield row 14 | row = "." + row + "." 15 | row = "".join(["^."[row[i] == row[i + 2]] for i in idx]) 16 | 17 | 18 | n_rows = extra.get("n_rows", 40) 19 | gen = generate_rows(data) 20 | safe = sum(next(gen).count(".") for _ in range(n_rows)) 21 | print("answer_a:", safe) 22 | safe += sum(next(gen).count(".") for _ in range(400000 - n_rows)) 23 | print("answer_b:", safe) 24 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q19.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 19: An Elephant Named Joseph --- 3 | https://adventofcode.com/2016/day/19 4 | """ 5 | from collections import deque 6 | 7 | from aocd import data 8 | 9 | 10 | def part_a(n): 11 | elves = deque(range(1, int(n) + 1)) 12 | while elves: 13 | elves.rotate(-1) 14 | elf = elves.popleft() 15 | return elf 16 | 17 | 18 | def part_b(n): 19 | n = int(n) 20 | elves = deque(range(1, n + 1)) 21 | elves.rotate((n + 1) // 2) 22 | while elves: 23 | elf = elves.popleft() 24 | elves.rotate(n // 2 + n // 2 - 1) 25 | n -= 1 26 | return elf 27 | 28 | 29 | print("answer_a:", part_a(data)) 30 | print("answer_b:", part_b(data)) 31 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q23.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 23: Safe Cracking --- 3 | https://adventofcode.com/2016/day/23 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.aoc2016 import AssembunnyComputer 8 | 9 | 10 | comp = AssembunnyComputer(data, a0=7) 11 | comp.run() 12 | print("answer_a:", comp.reg["a"]) 13 | 14 | comp.__init__(data, a0=12) 15 | comp.run() 16 | print("answer_b:", comp.reg["a"]) 17 | -------------------------------------------------------------------------------- /aoc_wim/aoc2016/q25.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 25: Clock Signal --- 3 | https://adventofcode.com/2016/day/25 4 | """ 5 | import re 6 | 7 | from aocd import data 8 | 9 | x, y = re.findall(r"\d+", data)[:2] 10 | a = 0b101010101010 - int(x) * int(y) 11 | print("answer_a:", a) 12 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: Inverse Captcha --- 3 | https://adventofcode.com/2017/day/1 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | 8 | 9 | def part_a(data, roll=1): 10 | a = np.fromiter(data, dtype=int) 11 | b = np.roll(a, roll) 12 | return a[a == b].sum() 13 | 14 | 15 | def part_b(data): 16 | return part_a(data, roll=len(data) // 2) 17 | 18 | 19 | print("answer_a:", part_a(data)) 20 | print("answer_b:", part_b(data)) 21 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q02.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 2: Corruption Checksum --- 3 | https://adventofcode.com/2017/day/2 4 | """ 5 | from itertools import combinations 6 | 7 | from aocd import data 8 | 9 | 10 | checksum = result = 0 11 | for line in data.splitlines(): 12 | row = [int(x) for x in line.split()] 13 | checksum += max(row) - min(row) 14 | for x, y in combinations(row, 2): 15 | denominator, numerator = sorted([x, y]) 16 | quotient, remainder = divmod(numerator, denominator) 17 | if not remainder: 18 | result += quotient 19 | break 20 | 21 | print("answer_a:", checksum) 22 | print("answer_b:", result) 23 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q04.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 4: High-Entropy Passphrases --- 3 | https://adventofcode.com/2017/day/4 4 | """ 5 | from aocd import data 6 | 7 | 8 | def has_dupe(txt): 9 | parts = txt.split() 10 | return len(parts) != len(set(parts)) 11 | 12 | 13 | def has_anagram(txt): 14 | parts = [tuple(sorted(x)) for x in txt.split()] 15 | return len(parts) != len(set(parts)) 16 | 17 | 18 | a = b = 0 19 | for txt in data.splitlines(): 20 | a += not has_dupe(txt) 21 | b += not has_anagram(txt) 22 | 23 | print("answer_a:", a) 24 | print("answer_b:", b) 25 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q05.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 5: A Maze of Twisty Trampolines, All Alike --- 3 | https://adventofcode.com/2017/day/5 4 | """ 5 | from aocd import data 6 | 7 | 8 | def part_a(data, b_offset=1): 9 | state = [int(x) for x in data.split()] 10 | i = pos = 0 11 | while True: 12 | try: 13 | offset = state[pos] 14 | except IndexError: 15 | part_a.final_state = state 16 | return i 17 | i += 1 18 | state[pos] += b_offset if offset >= 3 else 1 19 | pos += offset 20 | 21 | 22 | def part_b(data): 23 | return part_a(data, b_offset=-1) 24 | 25 | 26 | print("answer_a:", part_a(data)) 27 | print("answer_b:", part_b(data)) 28 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q06.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 6: Memory Reallocation --- 3 | https://adventofcode.com/2017/day/6 4 | """ 5 | from itertools import count 6 | 7 | import numpy as np 8 | from aocd import data 9 | 10 | 11 | def part_ab(data): 12 | a = np.fromstring(data, sep=" ", dtype=int) 13 | n = len(a) 14 | seen = {} 15 | for i in count(): 16 | t = tuple(a) 17 | if t in seen: 18 | return i, i - seen[t] 19 | seen[t] = i 20 | max_pos = a.argmax() 21 | q, r = divmod(a[max_pos], n) 22 | a[max_pos] = 0 23 | a += np.roll([q + 1] * r + [q] * (n - r), max_pos + 1) 24 | 25 | 26 | a, b = part_ab(data) 27 | print("answer_a:", a) 28 | print("answer_b:", b) 29 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q08_crazy.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 8: I Heard You Like Registers --- 3 | https://adventofcode.com/2017/day/8 4 | """ 5 | from aocd import data 6 | 7 | 8 | class crazydict(dict): 9 | def __missing__(self, key): 10 | if key == "wtf": 11 | return locals 12 | if key == "max": 13 | return max 14 | self[key] = 0 15 | return 0 16 | 17 | 18 | data += "\n" 19 | data = data.replace("\n", " else 0\nΣ = max(Σ, *wtf().values())\n") 20 | data = data.replace("inc", "+=").replace("dec", "-=") 21 | d = crazydict() 22 | exec(data, {}, d) 23 | b = d.pop("Σ") 24 | print("answer_a:", max(d.values())) 25 | print("answer_b:", b) 26 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q09.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 9: Stream Processing --- 3 | https://adventofcode.com/2017/day/9 4 | """ 5 | import re 6 | 7 | from aocd import data 8 | 9 | 10 | n_removed = 0 11 | while "!!" in data: 12 | data = data.replace("!!", "") 13 | data = re.sub("!.", "", data) 14 | n_removed += len(data) - len(re.sub("<.*?>", "", data)) 15 | n_removed -= 2 * len(re.findall("<.*?>", data)) 16 | data = re.sub("<.*?>", "", data) 17 | score = 0 18 | nesting = 0 19 | for c in data: 20 | if c == "{": 21 | nesting += 1 22 | elif c == "}": 23 | score += nesting 24 | nesting -= 1 25 | 26 | print("answer_a:", score) 27 | print("answer_b:", n_removed) 28 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q11.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 11: Hex Ed --- 3 | https://adventofcode.com/2017/day/11 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim import zgrid 8 | 9 | z = d = dmax = 0 10 | grid = zgrid.ZGrid({z: 1}) 11 | for step in data.split(","): 12 | z += zgrid.hexV[step] 13 | d = zgrid.hexagonal_distance(z) 14 | dmax = max(d, dmax) 15 | grid[z] = 1 16 | # grid.draw_hex(glyph=0, orientation="V", title=f" {d=}, {dmax=}") 17 | 18 | print("answer_a:", d) 19 | print("answer_b:", dmax) 20 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q12.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 12: Digital Plumber --- 3 | https://adventofcode.com/2017/day/12 4 | """ 5 | import networkx as nx 6 | from aocd import data 7 | 8 | 9 | graph = nx.Graph() 10 | for line in data.replace(" <->", ",").splitlines(): 11 | n0, *nodes = [int(n) for n in line.split(", ")] 12 | graph.add_node(n0) 13 | for node in nodes: 14 | graph.add_edge(n0, node) 15 | 16 | [a] = [len(g) for g in nx.connected_components(graph) if 0 in g] 17 | b = nx.number_connected_components(graph) 18 | 19 | print("answer_a:", a) 20 | print("answer_b:", b) 21 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q13.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 13: Packet Scanners --- 3 | https://adventofcode.com/2017/day/13 4 | """ 5 | from aocd import data 6 | 7 | 8 | depth2range = dict(map(int, line.split(":")) for line in data.splitlines()) 9 | print("answer_a:", sum(d * r for d, r in depth2range.items() if d % (2 * r - 2) == 0)) 10 | 11 | t = 0 12 | while not all((d + t) % (2 * r - 2) for d, r in depth2range.items()): 13 | t += 1 14 | print("answer_b:", t) 15 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q14.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 14: Disk Defragmentation --- 3 | https://adventofcode.com/2017/day/14 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | from scipy.ndimage import label 8 | 9 | from aoc_wim.aoc2017.q10 import knot_hash 10 | 11 | s = "".join(f"{int(knot_hash(f'{data}-{i}'), 16):0128b}" for i in range(128)) 12 | print("answer_a:", s.count("1")) 13 | print("answer_b:", label(np.fromiter(s, dtype=int).reshape(128, 128))[1]) 14 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q17.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 17: Spinlock --- 3 | https://adventofcode.com/2017/day/17 4 | """ 5 | from aocd import data 6 | 7 | n = int(data) 8 | 9 | L = [0] 10 | pos = 0 11 | for i in range(1, 2017 + 1): 12 | pos = 1 + (pos + n) % i 13 | L.insert(pos, i) 14 | print("answer_a:", L[pos + 1]) 15 | 16 | pos = 0 17 | i = b = 1 18 | while i <= 50000000: 19 | pos = 1 + (pos + n) % i 20 | if pos == 1: 21 | b = i 22 | # when pos is much smaller than i, we can skip 23 | # ahead iterations. as i gets bigger, this 24 | # becomes an increasingly effective speedup 25 | inci = (i - pos) // (n + 1) or 1 26 | pos += (n + 1) * (inci - 1) 27 | i += inci 28 | print("answer_b:", b) 29 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q19.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 19: A Series of Tubes --- 3 | https://adventofcode.com/2017/day/19 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.zgrid import ZGrid 8 | 9 | 10 | grid = ZGrid(data) 11 | z = data.splitlines()[0].index("|") 12 | assert grid[z] == "|" 13 | dz = ZGrid.down 14 | letters = "" 15 | n_steps = 0 16 | while True: 17 | z += dz 18 | n_steps += 1 19 | a = grid.get(z, " ") 20 | if a == "+": 21 | dz *= ZGrid.turn_left 22 | if grid.get(z + dz, " ") == " ": 23 | dz *= ZGrid.turn_around 24 | elif a not in "-| ": 25 | letters += a 26 | elif a == " ": 27 | break 28 | 29 | print("answer_a:", letters) 30 | print("answer_b:", n_steps) 31 | -------------------------------------------------------------------------------- /aoc_wim/aoc2017/q23.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 23: Coprocessor Conflagration --- 3 | https://adventofcode.com/2017/day/23 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.aoc2017 import Comp 8 | 9 | # import logging; logging.basicConfig(format="%(message)s", level=logging.DEBUG) 10 | 11 | comp_a = Comp(data) 12 | while not comp_a.blocked(): 13 | comp_a.step() 14 | print("answer_a:", comp_a.n_mul) 15 | 16 | comp_b = Comp(data, a0=1) 17 | comp_b.code[8:10] = ("wtf", "f", "b"), ("jnz", "1", "15") 18 | while not comp_b.blocked(): 19 | comp_b.step() 20 | print("answer_b:", comp_b.reg["h"]) 21 | -------------------------------------------------------------------------------- /aoc_wim/aoc2018/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wimglenn/advent-of-code-wim/d0f2404ef75921825b6a09295d0362d39ae94026/aoc_wim/aoc2018/__init__.py -------------------------------------------------------------------------------- /aoc_wim/aoc2018/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: Chronal Calibration --- 3 | https://adventofcode.com/2018/day/1 4 | """ 5 | from itertools import cycle 6 | 7 | from aocd import data 8 | 9 | 10 | ns = [int(x) for x in data.replace(",", " ").split()] 11 | print("answer_a:", sum(ns)) 12 | 13 | f = None 14 | if len({n > 0 for n in ns}) == 2: 15 | f = 0 16 | seen = {f} 17 | for n in cycle(ns): 18 | f += n 19 | if f in seen: 20 | break 21 | seen.add(f) 22 | print("answer_b:", f) 23 | -------------------------------------------------------------------------------- /aoc_wim/aoc2018/q02.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 2: Inventory Management System --- 3 | https://adventofcode.com/2018/day/2 4 | """ 5 | from collections import Counter 6 | from itertools import combinations 7 | 8 | from aocd import data 9 | 10 | 11 | counters = [Counter(s) for s in data.split()] 12 | doubles = sum(1 for c in counters if 2 in c.values()) 13 | triples = sum(1 for c in counters if 3 in c.values()) 14 | print("answer_a:", doubles * triples) 15 | 16 | for a, b in combinations(data.split(), 2): 17 | s = "".join([x for x, y in zip(a, b) if x == y]) 18 | if len(s) == len(a) - 1: 19 | print("answer_b:", s) 20 | break 21 | -------------------------------------------------------------------------------- /aoc_wim/aoc2018/q25.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 25: Four-Dimensional Adventure --- 3 | https://adventofcode.com/2018/day/25 4 | """ 5 | from itertools import combinations 6 | 7 | import networkx as nx 8 | from aocd import data 9 | 10 | nodes = [tuple(int(n) for n in s.split(",")) for s in data.splitlines()] 11 | graph = nx.Graph() 12 | graph.add_nodes_from(nodes) 13 | for node1, node2 in combinations(nodes, 2): 14 | if sum(abs(x - y) for x, y in zip(node1, node2)) <= 3: 15 | graph.add_edge(node1, node2) 16 | print("answer_a:", nx.number_connected_components(graph)) 17 | -------------------------------------------------------------------------------- /aoc_wim/aoc2019/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: The Tyranny of the Rocket Equation --- 3 | https://adventofcode.com/2019/day/1 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | 8 | 9 | A = np.fromstring(data, dtype=int, sep="\n") 10 | total = 0 11 | while A.any(): 12 | A = (A // 3 - 2).clip(0) 13 | if not total: 14 | print("answer_a:", A.sum()) 15 | total += A.sum() 16 | print("answer_b:", total) 17 | -------------------------------------------------------------------------------- /aoc_wim/aoc2019/q05.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 5: Sunny with a Chance of Asteroids --- 3 | https://adventofcode.com/2019/day/5 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.aoc2019 import IntComputer 8 | 9 | 10 | def compute(data, input_val): 11 | comp = IntComputer(data, inputs=[input_val]) 12 | comp.run() 13 | result, *zeros = comp.output 14 | for zero in zeros: 15 | assert zero == 0 16 | return result 17 | 18 | 19 | if __name__ == "__main__": 20 | print("answer_a:", compute(data, input_val=1)) 21 | print("answer_b:", compute(data, input_val=5)) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2019/q06.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 6: Universal Orbit Map --- 3 | https://adventofcode.com/2019/day/6 4 | """ 5 | import networkx as nx 6 | from aocd import data 7 | 8 | 9 | graph = nx.Graph(x.split(")") for x in data.splitlines()) 10 | print("answer_a:", sum(nx.shortest_path_length(graph, x, "COM") for x in graph)) 11 | if "YOU" in graph: 12 | print("answer_b:", nx.shortest_path_length(graph, "YOU", "SAN") - 2) 13 | -------------------------------------------------------------------------------- /aoc_wim/aoc2019/q08.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 8: Space Image Format --- 3 | https://adventofcode.com/2019/day/8 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | from aocd import extra 8 | 9 | from aoc_wim.ocr import AOCR 10 | 11 | w = extra.get("image_width", 25) 12 | h = extra.get("image_height", 6) 13 | a = np.fromiter(data, int).reshape((-1, h, w)) 14 | layer = min(a, key=lambda v: (v == 0).sum()) 15 | print("answer_a:", (layer == 1).sum() * (layer == 2).sum()) 16 | 17 | img = np.ones_like(layer) * 2 18 | for layer in a: 19 | np.copyto(img, layer, where=(img == 2)) 20 | 21 | if w != 3: 22 | print("answer_b:", AOCR[img]) 23 | -------------------------------------------------------------------------------- /aoc_wim/aoc2019/q09.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 9: Sensor Boost --- 3 | https://adventofcode.com/2019/day/9 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.aoc2019 import IntComputer 8 | 9 | 10 | def compute(data, inputs=()): 11 | comp = IntComputer(data, inputs=inputs) 12 | comp.run() 13 | result = ",".join([str(x) for x in reversed(comp.output)]) 14 | return result 15 | 16 | 17 | if __name__ == "__main__": 18 | print("answer_a:", compute(data, inputs=[1])) 19 | print("answer_b:", compute(data, inputs=[2])) 20 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: Report Repair --- 3 | https://adventofcode.com/2020/day/1 4 | """ 5 | from collections import Counter 6 | 7 | from aocd import data 8 | 9 | from aoc_wim.aoc2020 import find_pair 10 | 11 | 12 | counter = Counter(int(x) for x in data.splitlines()) 13 | x, y = find_pair(counter) 14 | print(f"answer_a: {x} * {y} == {x * y}") 15 | 16 | for z in list(counter): 17 | counter[z] -= 1 18 | try: 19 | x, y = find_pair(counter, target=2020 - z) 20 | except TypeError: 21 | counter[z] += 1 22 | else: 23 | assert x + y + z == 2020 24 | print(f"answer_b: {x} * {y} * {z} == {x * y * z}") 25 | break 26 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q02.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 2: Password Philosophy --- 3 | https://adventofcode.com/2020/day/2 4 | """ 5 | from aocd import data 6 | from parse import parse 7 | 8 | a = b = 0 9 | for line in data.splitlines(): 10 | x, y, char, passwd = parse("{:d}-{:d} {}: {}", line) 11 | a += x <= passwd.count(char) <= y 12 | b += (passwd[x - 1] + passwd[y - 1]).count(char) == 1 13 | 14 | print("answer_a:", a) 15 | print("answer_b:", b) 16 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q03.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 3: Toboggan Trajectory --- 3 | https://adventofcode.com/2020/day/3 4 | """ 5 | from math import prod 6 | 7 | from aocd import data 8 | 9 | from aoc_wim.zgrid import ZGrid 10 | 11 | grid = ZGrid(data) 12 | w, h = grid.width, grid.height 13 | dzs = {}.fromkeys([1 + 1j, 3 + 1j, 5 + 1j, 7 + 1j, 1 + 2j], 0) 14 | for dz in dzs: 15 | z = grid.top_left 16 | while z.imag < h: 17 | dzs[dz] += grid[complex(z.real % w, z.imag)] == "#" 18 | z += dz 19 | 20 | print("answer_a:", dzs[3 + 1j]) 21 | print("answer_b:", prod(dzs.values())) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q05.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 5: Binary Boarding --- 3 | https://adventofcode.com/2020/day/5 4 | """ 5 | from aocd import data 6 | 7 | tr = str.maketrans("FBLR", "0101") 8 | ids = {int(x.translate(tr), 2) for x in data.splitlines()} 9 | print("answer_a:", max(ids)) 10 | missing = set(range(min(ids), max(ids))) - ids 11 | print("answer_b:", *missing) 12 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q06.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 6: Custom Customs --- 3 | https://adventofcode.com/2020/day/6 4 | """ 5 | from aocd import data 6 | 7 | a = b = 0 8 | for block in data.split("\n\n"): 9 | s = {*block} - {"\n"} 10 | a += len(s) 11 | b += len(s.intersection(*block.splitlines())) 12 | 13 | print("answer_a:", a) 14 | print("answer_b:", b) 15 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q10.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 10: Adapter Array --- 3 | https://adventofcode.com/2020/day/10 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.stuff import Tribonacci 8 | 9 | numbers = [int(x) for x in data.split()] 10 | numbers.append(0) # outlet 11 | numbers.sort() 12 | Δ = [y - x for x, y in zip(numbers, numbers[1:])] 13 | Δ.append(3) # device 14 | print("answer_a:", Δ.count(1) * Δ.count(3)) 15 | 16 | tri = Tribonacci() 17 | Π = 1 18 | ones = 0 19 | for d in Δ: 20 | if d == 1: 21 | ones += 1 # finding longest streak of ones 22 | continue 23 | Π *= tri[ones + 2] or 1 # streak broken, cash in 24 | ones = 0 25 | print("answer_b:", Π) 26 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q10_dp.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 10: Adapter Array --- 3 | https://adventofcode.com/2020/day/10 4 | """ 5 | from aocd import data 6 | 7 | ns = [*map(int, data.split())] 8 | ns.sort() 9 | d1 = d3 = prev = 0 10 | for n in ns: 11 | d1 += n - prev == 1 12 | d3 += n - prev == 3 13 | prev = n 14 | d3 += 1 # extra hop to device 15 | print("answer_a:", d1 * d3) 16 | 17 | memo = {0: 1} 18 | for n in ns: 19 | memo[n] = sum(memo.get(n - i, 0) for i in range(4)) 20 | 21 | print("answer_b:", memo[n]) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q13.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 13: Shuttle Search --- 3 | https://adventofcode.com/2020/day/13 4 | """ 5 | import math 6 | 7 | from aocd import data 8 | 9 | t0, table = data.splitlines() 10 | t0 = int(t0) 11 | table = {-i: int(m) for i, m in enumerate(table.split(",")) if m != "x"} 12 | bs, buses = zip(*table.items()) 13 | wait, bus = min([(-t0 % b, b) for b in buses]) 14 | print("answer_a:", wait * bus) 15 | 16 | # chinese remainder theorem... 17 | M = math.lcm(*buses) 18 | ns = [M // m for m in buses] 19 | nis = [pow(n, -1, m) for n, m in zip(ns, buses)] 20 | t = sum(b*n*ni for b, n, ni in zip(bs, ns, nis)) % M 21 | print("answer_b:", t) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q13_sync.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 13: Shuttle Search --- 3 | https://adventofcode.com/2020/day/13 4 | """ 5 | from aocd import data 6 | 7 | t0, table = data.splitlines() 8 | t0 = int(t0) 9 | buses = [(i, int(b)) for i, b in enumerate(table.split(",")) if b != "x"] 10 | wait, bus = min([(-t0 % b, b) for _, b in buses]) 11 | print("answer_a:", wait * bus) 12 | 13 | timestamp = 0 14 | increment = 1 15 | synced = {} 16 | while len(synced) < len(buses): 17 | timestamp += increment 18 | for phase, bus in buses: 19 | if bus not in synced: 20 | if (timestamp + phase) % bus == 0: 21 | increment *= bus 22 | synced[bus] = timestamp 23 | print("answer_b:", timestamp) 24 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q15.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 15: Rambunctious Recitation --- 3 | https://adventofcode.com/2020/day/15 4 | """ 5 | from aocd import data 6 | 7 | 8 | # CPython hack: loading names in a local namespace (LOAD_FAST op) is 9 | # quicker than loading names in a module namespace (LOAD_GLOBAL op) 10 | def local(n): 11 | seen = {} 12 | get = seen.get 13 | for i0, prev in enumerate(ns, start=1): 14 | seen[prev] = i0 15 | for i in range(i0, n): 16 | seen[prev], prev = i, i - get(prev, i) 17 | return prev 18 | 19 | 20 | ns = [int(x) for x in data.split(",")] 21 | print("answer_a:", local(2020)) 22 | print("answer_b:", local(30000000)) 23 | -------------------------------------------------------------------------------- /aoc_wim/aoc2020/q25.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 25: Combo Breaker --- 3 | https://adventofcode.com/2020/day/25 4 | """ 5 | from aocd import data 6 | 7 | 8 | def crack(pk_card, pk_door, subject_number=7, modulus=20201227): 9 | loop_size = 0 10 | p = 1 11 | while True: 12 | loop_size += 1 13 | p = p * subject_number % modulus 14 | if p == pk_card: 15 | return pow(pk_door, loop_size, modulus) 16 | if p == pk_door: 17 | return pow(pk_card, loop_size, modulus) 18 | 19 | 20 | pk_card, pk_door = data.split() 21 | print("answer_a:", crack(int(pk_card), int(pk_door))) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2021/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wimglenn/advent-of-code-wim/d0f2404ef75921825b6a09295d0362d39ae94026/aoc_wim/aoc2021/__init__.py -------------------------------------------------------------------------------- /aoc_wim/aoc2021/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: Sonar Sweep --- 3 | https://adventofcode.com/2021/day/1 4 | """ 5 | from aocd import data 6 | 7 | ns = [int(n) for n in data.split()] 8 | print("answer_a:", sum(n2 > n1 for n1, n2 in zip(ns, ns[1:]))) 9 | print("answer_b:", sum(n2 > n1 for n1, n2 in zip(ns, ns[3:]))) 10 | -------------------------------------------------------------------------------- /aoc_wim/aoc2021/q02.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 2: Dive! --- 3 | https://adventofcode.com/2021/day/2 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.zgrid import ZGrid 8 | 9 | aim = za = zb = 0 10 | for line in data.splitlines(): 11 | direction, X = line.split() 12 | X = int(X) 13 | dz = ZGrid.dzs[direction] * X 14 | za += dz 15 | if direction == "forward": 16 | zb += dz + aim * X 17 | else: 18 | aim += dz 19 | 20 | print("answer_a:", int(za.real) * int(za.imag)) 21 | print("answer_b:", int(zb.real) * int(zb.imag)) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2021/q06.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 6: Lanternfish --- 3 | https://adventofcode.com/2021/day/6 4 | """ 5 | from aocd import data 6 | 7 | 8 | def rotate(fish, n=1): 9 | for _ in range(n): 10 | fish[:] = fish[1:] + fish[:1] 11 | fish[6] += fish[-1] 12 | return sum(fish) 13 | 14 | 15 | fish = [data.count(f) for f in "012345678"] 16 | print("answer_a:", rotate(fish, n=80)) 17 | print("answer_b:", rotate(fish, n=256-80)) 18 | -------------------------------------------------------------------------------- /aoc_wim/aoc2021/q07.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 7: The Treachery of Whales --- 3 | https://adventofcode.com/2021/day/7 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | 8 | A = np.array([int(n) for n in data.split(",")]) 9 | a = b = np.inf 10 | for n in range(A.min(), A.max()): 11 | d = abs(A - n) 12 | a = min(a, d.sum()) 13 | b = min(b, (d * (d + 1) // 2).sum()) 14 | 15 | print("answer_a:", a) 16 | print("answer_b:", b) 17 | -------------------------------------------------------------------------------- /aoc_wim/aoc2021/q09.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 9: Smoke Basin --- 3 | https://adventofcode.com/2021/day/9 4 | """ 5 | import networkx as nx 6 | from aocd import data 7 | 8 | from aoc_wim.zgrid import ZGrid 9 | 10 | g = ZGrid(data) 11 | bs = sorted(nx.connected_components(g.graph(extra="012345678")), key=len) 12 | print("answer_a:", sum(min([1 + int(g[z]) for z in b]) for b in bs)) 13 | print("answer_b:", len(bs[-1]) * len(bs[-2]) * len(bs[-3])) 14 | -------------------------------------------------------------------------------- /aoc_wim/aoc2021/q14.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 14: Extended Polymerization --- 3 | https://adventofcode.com/2021/day/14 4 | """ 5 | from collections import Counter 6 | 7 | from aocd import data 8 | 9 | polymer, rules = data.split("\n\n") 10 | tr = dict(r.split(" -> ") for r in rules.splitlines()) 11 | c0 = Counter(x + y for x, y in zip(polymer, polymer[1:])) 12 | c = Counter(polymer) 13 | for i in range(40): 14 | if i == 10: 15 | print("answer_a:", max(c.values()) - min(c.values())) 16 | c1 = Counter() 17 | for xy, n in c0.items(): 18 | c1[xy[0] + tr[xy]] += n 19 | c1[tr[xy] + xy[1]] += n 20 | c += {tr[xy]: n} 21 | c0 = c1 22 | print("answer_b:", max(c.values()) - min(c.values())) 23 | -------------------------------------------------------------------------------- /aoc_wim/aoc2021/q20.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 20: Trench Map --- 3 | https://adventofcode.com/2021/day/20 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | from scipy.signal import convolve2d 8 | 9 | s, grid = data.split("\n\n") 10 | s = np.array([c == "#" for c in s.replace("\n", "")]) 11 | im = np.array([[*r] for r in grid.splitlines()]) == "#" 12 | kernel = 2 ** np.arange(9).reshape(3, 3) 13 | for i in range(50): 14 | im = s[convolve2d(im, kernel, fillvalue=s[0]*i % 2)] 15 | if i == 1: 16 | print("answer_a:", im.sum()) 17 | print("answer_b:", im.sum()) 18 | -------------------------------------------------------------------------------- /aoc_wim/aoc2022/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wimglenn/advent-of-code-wim/d0f2404ef75921825b6a09295d0362d39ae94026/aoc_wim/aoc2022/__init__.py -------------------------------------------------------------------------------- /aoc_wim/aoc2022/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: Calorie Counting --- 3 | https://adventofcode.com/2022/day/1 4 | """ 5 | from heapq import nlargest 6 | 7 | from aocd import data 8 | 9 | cals = [] 10 | for chunk in data.split("\n\n"): 11 | cals.append(sum(map(int, chunk.split()))) 12 | 13 | print("answer_a:", max(cals)) 14 | print("answer_b:", sum(nlargest(3, cals))) 15 | -------------------------------------------------------------------------------- /aoc_wim/aoc2022/q03.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 3: Rucksack Reorganization --- 3 | https://adventofcode.com/2022/day/3 4 | """ 5 | from itertools import batched 6 | 7 | from aocd import data 8 | 9 | a = 0 10 | for line in data.splitlines(): 11 | i = len(line) // 2 # midpoint 12 | left, right = line[:i], line[i:] 13 | [c] = set(left).intersection(right) 14 | a += c.isupper() * 26 15 | a += ord(c.lower()) - ord("a") + 1 16 | 17 | b = 0 18 | for s1, s2, s3 in batched(data.splitlines(), 3): 19 | [c] = set(s1).intersection(s2, s3) 20 | b += c.isupper() * 26 21 | b += ord(c.lower()) - ord("a") + 1 22 | 23 | print("answer_a:", a) 24 | print("answer_b:", b) 25 | -------------------------------------------------------------------------------- /aoc_wim/aoc2022/q04.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 4: Camp Cleanup --- 3 | https://adventofcode.com/2022/day/4 4 | """ 5 | from aocd import data 6 | from parse import parse 7 | 8 | a = b = 0 9 | for line in data.splitlines(): 10 | l1, r1, l2, r2 = parse("{:d}-{:d},{:d}-{:d}", line).fixed 11 | if l1 > l2 or (l1 == l2 and r1 < r2): 12 | l1, r1, l2, r2 = l2, r2, l1, r1 13 | a += r2 <= r1 14 | b += r1 >= l2 15 | 16 | print("answer_a:", a) 17 | print("answer_b:", b) 18 | -------------------------------------------------------------------------------- /aoc_wim/aoc2022/q06.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 6: Tuning Trouble --- 3 | https://adventofcode.com/2022/day/6 4 | """ 5 | from collections import Counter 6 | 7 | from aocd import data 8 | 9 | 10 | def marker(data, n): 11 | counts = Counter(data[:n]) 12 | i = n 13 | while len(counts) < n: 14 | if data[i] != data[i - n]: 15 | counts += {data[i]: 1, data[i - n]: -1} 16 | i += 1 17 | return i 18 | 19 | 20 | print("answer_a:", marker(data, 4)) 21 | print("answer_b:", marker(data, 14)) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2022/q12.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 12: Hill Climbing Algorithm --- 3 | https://adventofcode.com/2022/day/12 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.search import AStar 8 | from aoc_wim.zgrid import ZGrid 9 | 10 | grid = ZGrid(data) 11 | start = grid.z("S") 12 | end = grid.z("E") 13 | grid[start] = "a" 14 | grid[end] = "z" 15 | 16 | 17 | class A𖤐(AStar): 18 | def adjacent(self, z0): 19 | return [z for z in grid.near(z0) if ord(grid[z0]) - ord(grid.get(z, "_")) <= 1] 20 | 21 | def target_reached(self, z, target): 22 | return z == target or grid[z] == target 23 | 24 | 25 | print("answer_a:", len(A𖤐(end, start).run()) - 1) 26 | print("answer_b:", len(A𖤐(end, "a").run()) - 1) 27 | -------------------------------------------------------------------------------- /aoc_wim/aoc2022/q20.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 20: Grove Positioning System --- 3 | https://adventofcode.com/2022/day/20 4 | """ 5 | from aocd import data 6 | 7 | 8 | for key, rounds, part in zip((1, 811589153), (1, 10), "ab"): 9 | ns = [int(n) * key for n in data.split()] 10 | N = len(ns) 11 | idx = [*range(N)] 12 | for _ in range(rounds): 13 | for i in range(N): 14 | idx.pop(pos := idx.index(i)) 15 | idx.insert((pos + ns[i]) % (N - 1), i) 16 | i0 = idx.index(ns.index(0)) # where did 0 get 'mixed' to? 17 | result = sum(ns[idx[(i0 + i) % N]] for i in [1000, 2000, 3000]) 18 | print(f"answer_{part}:", result) 19 | -------------------------------------------------------------------------------- /aoc_wim/aoc2023/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wimglenn/advent-of-code-wim/d0f2404ef75921825b6a09295d0362d39ae94026/aoc_wim/aoc2023/__init__.py -------------------------------------------------------------------------------- /aoc_wim/aoc2023/q01.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 1: Trebuchet?! --- 3 | https://adventofcode.com/2023/day/1 4 | """ 5 | import regex as re 6 | from aocd import data 7 | 8 | ns = "one, two, three, four, five, six, seven, eight, nine".split(", ") 9 | d = dict(zip(ns, "123456789")) 10 | a = b = 0 11 | pat_a = re.compile(r"\d") 12 | pat_b = re.compile(rf"(\d|{'|'.join(ns)})") 13 | for line in data.splitlines(): 14 | nums_a = [int(x) for x in pat_a.findall(line)] or [0] 15 | nums_b = [int(d.get(x, x)) for x in pat_b.findall(line, overlapped=True)] or [0] 16 | a += nums_a[0] * 10 + nums_a[-1] 17 | b += nums_b[0] * 10 + nums_b[-1] 18 | 19 | print("answer_a:", a) 20 | print("answer_b:", b) 21 | -------------------------------------------------------------------------------- /aoc_wim/aoc2023/q02.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 2: Cube Conundrum --- 3 | https://adventofcode.com/2023/day/2 4 | """ 5 | from collections import Counter 6 | from math import prod 7 | 8 | from aocd import data 9 | 10 | bag = Counter("rgb"*12 + "g" + "bb") 11 | a = b = 0 12 | for line in data.replace(";", ",").splitlines(): 13 | g, line = line.removeprefix("Game").split(":") 14 | d = Counter() 15 | for n_c in line.split(","): 16 | n, c = n_c.split() 17 | d[c[0]] = max(d[c[0]], int(n)) 18 | a += int(g) * (d <= bag) 19 | b += prod(d.values()) 20 | 21 | print("answer_a:", a) 22 | print("answer_b:", b) 23 | -------------------------------------------------------------------------------- /aoc_wim/aoc2023/q04.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 4: Scratchcards --- 3 | https://adventofcode.com/2023/day/4 4 | """ 5 | from aocd import data 6 | 7 | lines = data.splitlines() 8 | cards = [1] * len(lines) 9 | a = 0 10 | for i, line in enumerate(lines): 11 | L, R = line.split("|") 12 | w = {*L.split()} & {*R.split()} 13 | a += int(2 ** (len(w) - 1)) 14 | for j in range(min(len(w), len(cards))): 15 | cards[i + 1 + j] += cards[i] 16 | 17 | print("answer_a:", a) 18 | print("answer_b:", sum(cards)) 19 | -------------------------------------------------------------------------------- /aoc_wim/aoc2023/q06.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 6: Wait For It --- 3 | https://adventofcode.com/2023/day/6 4 | """ 5 | from math import prod 6 | from math import sqrt 7 | 8 | from aocd import data 9 | 10 | 11 | def quadratic(t, d): 12 | return t - 1 - 2*int(t/2 - sqrt(t*t - 4*d)/2) 13 | 14 | 15 | ts, ds = data.splitlines() 16 | ts = ts.split()[1:] 17 | ds = ds.split()[1:] 18 | 19 | print("answer_a:", prod(quadratic(int(t), int(d)) for t, d in zip(ts, ds))) 20 | print("answer_b:", quadratic(int("".join(ts)), int("".join(ds)))) 21 | -------------------------------------------------------------------------------- /aoc_wim/aoc2023/q09.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 9: Mirage Maintenance --- 3 | https://adventofcode.com/2023/day/9 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | 8 | 9 | n = len(data.splitlines()) 10 | A = A0 = np.fromstring(data, sep=" ", dtype=int).reshape(n, -1).T 11 | As = [A0] 12 | while A.any(): 13 | A = A[1:] - A[:-1] 14 | As.append(A) 15 | 16 | As.reverse() 17 | Ba = Bb = np.pad(A, [(0, 1), (0, 0)]) 18 | for A0, A1 in zip(As, As[1:]): 19 | Ba = np.vstack([A0[:1], A1 + Ba]) 20 | Bb = np.vstack([A1 - Bb, A0[-1:]]) 21 | 22 | print("answer_a:", int(Ba[-1].sum())) 23 | print("answer_b:", int(Bb[0].sum())) 24 | -------------------------------------------------------------------------------- /aoc_wim/aoc2023/q13.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 13: Point of Incidence --- 3 | https://adventofcode.com/2023/day/13 4 | """ 5 | from aocd import data 6 | 7 | data = data.translate(str.maketrans("#.", "10")) 8 | a = b = 0 9 | for chunk in data.split("\n\n"): 10 | nr = [int(line, 2) for line in chunk.splitlines()] 11 | nc = [int("".join(line), 2) for line in zip(*chunk.splitlines())] 12 | for ns, f in zip([nr, nc], [100, 1]): 13 | for i in range(len(ns)): 14 | p = sum([(x ^ y).bit_count() for x, y in zip(ns[:i][::-1], ns[i:])]) 15 | a += f * i * (p == 0) 16 | b += f * i * (p == 1) 17 | 18 | print("answer_a:", a) 19 | print("answer_b:", b) 20 | -------------------------------------------------------------------------------- /aoc_wim/aoc2023/q13_numpy.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 13: Point of Incidence --- 3 | https://adventofcode.com/2023/day/13 4 | """ 5 | import numpy as np 6 | from aocd import data 7 | 8 | a = b = 0 9 | for chunk in data.split("\n\n"): 10 | h = chunk.count("\n") + 1 11 | A = np.fromiter(chunk.replace("\n", ""), dtype=" 0] += 3 * pa + pb 21 | a, b = ab 22 | 23 | print("answer_a:", a) 24 | print("answer_b:", b) 25 | -------------------------------------------------------------------------------- /aoc_wim/aoc2024/q17_decompiled.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 17: Chronospatial Computer --- 3 | https://adventofcode.com/2024/day/17 4 | """ 5 | prog = [2, 4, 1, 1, 7, 5, 1, 5, 4, 0, 0, 3, 5, 5, 3, 0] 6 | As = [0o4_532_307_133_267_275] 7 | for A in As: 8 | print(f"{oct(A)}: ", end="") 9 | while A: 10 | B = (A & 7) ^ 0b001 11 | C = A >> B 12 | out = ((B ^ 0b101) ^ C) & 7 13 | print(out, end=",") 14 | A >>= 3 15 | print() 16 | -------------------------------------------------------------------------------- /aoc_wim/aoc2024/q19.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 19: Linen Layout --- 3 | https://adventofcode.com/2024/day/19 4 | """ 5 | from functools import cache 6 | 7 | from aocd import data 8 | 9 | 10 | @cache 11 | def ways(design): 12 | if not design: 13 | return 1 14 | return sum(ways(design[len(p):]) for p in patterns if design.startswith(p)) 15 | 16 | 17 | patterns, designs = data.split("\n\n") 18 | patterns = patterns.split(", ") 19 | results = [ways(d) for d in designs.split()] 20 | print("answer_a:", sum(map(bool, results))) 21 | print("answer_b:", sum(results)) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2024/q23.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 23: LAN Party --- 3 | https://adventofcode.com/2024/day/23 4 | """ 5 | import itertools as it 6 | 7 | import networkx as nx 8 | from aocd import data 9 | 10 | 11 | graph = nx.Graph(x.split("-") for x in data.split()) 12 | triples = set() 13 | for t in graph: 14 | if t.startswith("t"): 15 | for u, v in it.combinations(graph[t], 2): 16 | if (u, v) in graph.edges(): 17 | triples.add(frozenset([t, u, v])) 18 | print("answer_a:", len(triples)) 19 | 20 | clique = max(nx.find_cliques(graph), key=len) 21 | print("answer_b:", ",".join(sorted(clique))) 22 | -------------------------------------------------------------------------------- /aoc_wim/aoc2024/q25.py: -------------------------------------------------------------------------------- 1 | """ 2 | --- Day 25: Code Chronicle --- 3 | https://adventofcode.com/2024/day/25 4 | """ 5 | from aocd import data 6 | 7 | from aoc_wim.zgrid import ZGrid 8 | 9 | 10 | chunks = data.split("\n\n") 11 | keys = [] 12 | locks = [] 13 | for chunk in chunks: 14 | zs = set(ZGrid(chunk).z("#", first=False)) 15 | L = keys if chunk[0] == "." else locks 16 | L.append(zs) 17 | 18 | a = sum(1 for lock in locks for key in keys if not lock & key) 19 | print("answer_a:", a) 20 | -------------------------------------------------------------------------------- /tests/2015/01/0.txt: -------------------------------------------------------------------------------- 1 | (()) 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/1.txt: -------------------------------------------------------------------------------- 1 | ()() 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/10.txt: -------------------------------------------------------------------------------- 1 | ()()) 2 | - 3 | 5 4 | -------------------------------------------------------------------------------- /tests/2015/01/2.txt: -------------------------------------------------------------------------------- 1 | ((( 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/3.txt: -------------------------------------------------------------------------------- 1 | (()(()( 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/4.txt: -------------------------------------------------------------------------------- 1 | ))((((( 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/5.txt: -------------------------------------------------------------------------------- 1 | ()) 2 | -1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/6.txt: -------------------------------------------------------------------------------- 1 | ))( 2 | -1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/7.txt: -------------------------------------------------------------------------------- 1 | ))) 2 | -3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/8.txt: -------------------------------------------------------------------------------- 1 | )())()) 2 | -3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/01/9.txt: -------------------------------------------------------------------------------- 1 | ) 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2015/02/0.txt: -------------------------------------------------------------------------------- 1 | 2x3x4 2 | 58 3 | 34 4 | -------------------------------------------------------------------------------- /tests/2015/02/1.txt: -------------------------------------------------------------------------------- 1 | 1x1x10 2 | 43 3 | 14 4 | -------------------------------------------------------------------------------- /tests/2015/03/0.txt: -------------------------------------------------------------------------------- 1 | > 2 | 2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/03/1.txt: -------------------------------------------------------------------------------- 1 | ^>v< 2 | 4 3 | 3 4 | -------------------------------------------------------------------------------- /tests/2015/03/2.txt: -------------------------------------------------------------------------------- 1 | ^v^v^v^v^v 2 | 2 3 | 11 4 | -------------------------------------------------------------------------------- /tests/2015/03/3.txt: -------------------------------------------------------------------------------- 1 | ^v 2 | - 3 | 3 4 | -------------------------------------------------------------------------------- /tests/2015/04/0.slow.txt: -------------------------------------------------------------------------------- 1 | abcdef 2 | 609043 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/04/1.slow.txt: -------------------------------------------------------------------------------- 1 | pqrstuv 2 | 1048970 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/05/0.txt: -------------------------------------------------------------------------------- 1 | ugknbfddgicrmopn 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/05/1.txt: -------------------------------------------------------------------------------- 1 | aaa 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/05/2.txt: -------------------------------------------------------------------------------- 1 | jchzalrnumimnmhp 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/05/3.txt: -------------------------------------------------------------------------------- 1 | haegwjzuvuyypxyu 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/05/4.txt: -------------------------------------------------------------------------------- 1 | dvszwmarrgswjxmb 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/05/5.txt: -------------------------------------------------------------------------------- 1 | qjhvhtzxzqqjkmpb 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2015/05/6.txt: -------------------------------------------------------------------------------- 1 | xxyxx 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2015/05/7.txt: -------------------------------------------------------------------------------- 1 | uurcxstgmygtbstg 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2015/05/8.txt: -------------------------------------------------------------------------------- 1 | ieodomkazucvgmuy 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2015/06/0.txt: -------------------------------------------------------------------------------- 1 | turn on 0,0 through 999,999 2 | 1000000 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/06/1.txt: -------------------------------------------------------------------------------- 1 | toggle 0,0 through 999,0 2 | 1000 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/06/2.txt: -------------------------------------------------------------------------------- 1 | turn off 499,499 through 500,500 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/06/3.txt: -------------------------------------------------------------------------------- 1 | turn on 0,0 through 0,0 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2015/06/4.txt: -------------------------------------------------------------------------------- 1 | toggle 0,0 through 999,999 2 | - 3 | 2000000 4 | -------------------------------------------------------------------------------- /tests/2015/07/0.d.txt: -------------------------------------------------------------------------------- 1 | 123 -> x 2 | 456 -> y 3 | x AND y -> a 4 | x OR y -> e 5 | x LSHIFT 2 -> f 6 | y RSHIFT 2 -> g 7 | NOT x -> h 8 | NOT y -> i 9 | 72 # wire=d 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/07/1.e.txt: -------------------------------------------------------------------------------- 1 | 123 -> x 2 | 456 -> y 3 | x AND y -> d 4 | x OR y -> a 5 | x LSHIFT 2 -> f 6 | y RSHIFT 2 -> g 7 | NOT x -> h 8 | NOT y -> i 9 | 507 # wire=e 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/07/2.f.txt: -------------------------------------------------------------------------------- 1 | 123 -> x 2 | 456 -> y 3 | x AND y -> d 4 | x OR y -> e 5 | x LSHIFT 2 -> a 6 | y RSHIFT 2 -> g 7 | NOT x -> h 8 | NOT y -> i 9 | 492 # wire=f 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/07/3.g.txt: -------------------------------------------------------------------------------- 1 | 123 -> x 2 | 456 -> y 3 | x AND y -> d 4 | x OR y -> e 5 | x LSHIFT 2 -> f 6 | y RSHIFT 2 -> a 7 | NOT x -> h 8 | NOT y -> i 9 | 114 # wire=g 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/07/4.h.txt: -------------------------------------------------------------------------------- 1 | 123 -> x 2 | 456 -> y 3 | x AND y -> d 4 | x OR y -> e 5 | x LSHIFT 2 -> f 6 | y RSHIFT 2 -> g 7 | NOT x -> a 8 | NOT y -> i 9 | 65412 # wire=h 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/07/5.i.txt: -------------------------------------------------------------------------------- 1 | 123 -> x 2 | 456 -> y 3 | x AND y -> d 4 | x OR y -> e 5 | x LSHIFT 2 -> f 6 | y RSHIFT 2 -> g 7 | NOT x -> h 8 | NOT y -> a 9 | 65079 # wire=i 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/07/6.x.txt: -------------------------------------------------------------------------------- 1 | 123 -> a 2 | 456 -> y 3 | a AND y -> d 4 | a OR y -> e 5 | a LSHIFT 2 -> f 6 | y RSHIFT 2 -> g 7 | NOT a -> h 8 | NOT y -> i 9 | 123 # wire=x 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/07/7.y.txt: -------------------------------------------------------------------------------- 1 | 123 -> x 2 | 456 -> a 3 | x AND a -> d 4 | x OR a -> e 5 | x LSHIFT 2 -> f 6 | a RSHIFT 2 -> g 7 | NOT x -> h 8 | NOT a -> i 9 | 456 # wire=y 10 | - 11 | -------------------------------------------------------------------------------- /tests/2015/08/0.txt: -------------------------------------------------------------------------------- 1 | "" 2 | "abc" 3 | "aaa\"aaa" 4 | "\x27" 5 | 12 6 | 19 7 | -------------------------------------------------------------------------------- /tests/2015/09/0.txt: -------------------------------------------------------------------------------- 1 | London to Dublin = 464 2 | London to Belfast = 518 3 | Dublin to Belfast = 141 4 | 605 5 | 982 6 | -------------------------------------------------------------------------------- /tests/2015/10/0.txt: -------------------------------------------------------------------------------- 1 | 211 2 | 4 # iterations=1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/10/1.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 # iterations=1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/10/2.txt: -------------------------------------------------------------------------------- 1 | 11 2 | 2 # iterations=1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/10/3.txt: -------------------------------------------------------------------------------- 1 | 21 2 | 4 # iterations=1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/10/4.txt: -------------------------------------------------------------------------------- 1 | 1211 2 | 6 # iterations=1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/10/5.txt: -------------------------------------------------------------------------------- 1 | 111221 2 | 6 # iterations=1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/11/0.txt: -------------------------------------------------------------------------------- 1 | abcdefgh 2 | abcdffaa 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/11/1.slow.txt: -------------------------------------------------------------------------------- 1 | ghijklmn 2 | ghjaabcc 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/0.txt: -------------------------------------------------------------------------------- 1 | [1,2,3] 2 | 6 3 | 6 4 | -------------------------------------------------------------------------------- /tests/2015/12/1.txt: -------------------------------------------------------------------------------- 1 | {"a":2,"b":4} 2 | 6 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/10.txt: -------------------------------------------------------------------------------- 1 | [1,"red",5] 2 | - 3 | 6 4 | -------------------------------------------------------------------------------- /tests/2015/12/2.txt: -------------------------------------------------------------------------------- 1 | [[[3]]] 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/3.txt: -------------------------------------------------------------------------------- 1 | {"a":{"b":4},"c":-1} 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/4.txt: -------------------------------------------------------------------------------- 1 | {"a":[-1,1]} 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/5.txt: -------------------------------------------------------------------------------- 1 | [-1,{"a":1}] 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/6.txt: -------------------------------------------------------------------------------- 1 | [] 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/7.txt: -------------------------------------------------------------------------------- 1 | {} 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/12/8.txt: -------------------------------------------------------------------------------- 1 | [1,{"c":"red","b":2},3] 2 | - 3 | 4 4 | -------------------------------------------------------------------------------- /tests/2015/12/9.txt: -------------------------------------------------------------------------------- 1 | {"d":"red","e":[1,2,3,4],"f":5} 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2015/14/0.txt: -------------------------------------------------------------------------------- 1 | Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds. 2 | Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds. 3 | 1120 # t=1000 4 | 689 5 | -------------------------------------------------------------------------------- /tests/2015/15/0.txt: -------------------------------------------------------------------------------- 1 | Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8 2 | Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3 3 | 62842880 4 | 57600000 5 | -------------------------------------------------------------------------------- /tests/2015/17/0.txt: -------------------------------------------------------------------------------- 1 | 20 2 | 15 3 | 10 4 | 5 5 | 5 6 | 4 # liters=25 7 | 3 8 | -------------------------------------------------------------------------------- /tests/2015/18/0.txt: -------------------------------------------------------------------------------- 1 | .#.#.# 2 | ...##. 3 | #....# 4 | ..#... 5 | #.#..# 6 | ####.. 7 | 4 # iterations=4 8 | - 9 | -------------------------------------------------------------------------------- /tests/2015/18/1.txt: -------------------------------------------------------------------------------- 1 | ##.#.# 2 | ...##. 3 | #....# 4 | ..#... 5 | #.#..# 6 | ####.# 7 | - 8 | 17 # iterations=5 9 | -------------------------------------------------------------------------------- /tests/2015/19/0.txt: -------------------------------------------------------------------------------- 1 | H => HO 2 | H => OH 3 | O => HH 4 | 5 | HOH 6 | 4 7 | - 8 | -------------------------------------------------------------------------------- /tests/2015/19/1.txt: -------------------------------------------------------------------------------- 1 | H => HO 2 | H => OH 3 | O => HH 4 | 5 | HOHOHO 6 | 7 7 | - 8 | -------------------------------------------------------------------------------- /tests/2015/19/2.txt: -------------------------------------------------------------------------------- 1 | e => H 2 | e => O 3 | H => HO 4 | H => OH 5 | O => HH 6 | 7 | HOH 8 | - 9 | 3 10 | -------------------------------------------------------------------------------- /tests/2015/19/3.txt: -------------------------------------------------------------------------------- 1 | e => H 2 | e => O 3 | H => HO 4 | H => OH 5 | O => HH 6 | 7 | HOHOHO 8 | - 9 | 6 10 | -------------------------------------------------------------------------------- /tests/2015/23/0.txt: -------------------------------------------------------------------------------- 1 | inc a 2 | jio a, +2 3 | tpl a 4 | inc a 5 | 0 6 | 0 7 | -------------------------------------------------------------------------------- /tests/2015/24/0.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 7 7 | 8 8 | 9 9 | 10 10 | 11 11 | 99 12 | 44 13 | -------------------------------------------------------------------------------- /tests/2015/25/0.row1_col1.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 1, column 1. 2 | 20151125 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/1.row1_col2.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 1, column 2. 2 | 18749137 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/10.row2_col5.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 2, column 5. 2 | 15514188 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/11.row2_col6.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 2, column 6. 2 | 4041754 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/12.row3_col1.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 3, column 1. 2 | 16080970 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/13.row3_col2.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 3, column 2. 2 | 8057251 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/14.row3_col3.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 3, column 3. 2 | 1601130 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/15.row3_col4.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 3, column 4. 2 | 7981243 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/16.row3_col5.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 3, column 5. 2 | 11661866 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/17.row3_col6.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 3, column 6. 2 | 16474243 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/18.row4_col1.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 4, column 1. 2 | 24592653 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/19.row4_col2.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 4, column 2. 2 | 32451966 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/2.row1_col3.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 1, column 3. 2 | 17289845 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/20.row4_col3.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 4, column 3. 2 | 21345942 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/21.row4_col4.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 4, column 4. 2 | 9380097 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/22.row4_col5.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 4, column 5. 2 | 10600672 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/23.row4_col6.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 4, column 6. 2 | 31527494 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/24.row5_col1.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 5, column 1. 2 | 77061 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/25.row5_col2.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 5, column 2. 2 | 17552253 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/26.row5_col3.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 5, column 3. 2 | 28094349 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/27.row5_col4.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 5, column 4. 2 | 6899651 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/28.row5_col5.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 5, column 5. 2 | 9250759 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/29.row5_col6.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 5, column 6. 2 | 31663883 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/3.row1_col4.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 1, column 4. 2 | 30943339 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/30.row6_col1.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 6, column 1. 2 | 33071741 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/31.row6_col2.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 6, column 2. 2 | 6796745 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/32.row6_col3.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 6, column 3. 2 | 25397450 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/33.row6_col4.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 6, column 4. 2 | 24659492 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/34.row6_col5.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 6, column 5. 2 | 1534922 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/35.row6_col6.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 6, column 6. 2 | 27995004 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/4.row1_col5.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 1, column 5. 2 | 10071777 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/5.row1_col6.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 1, column 6. 2 | 33511524 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/6.row2_col1.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 2, column 1. 2 | 31916031 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/7.row2_col2.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 2, column 2. 2 | 21629792 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/8.row2_col3.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 2, column 3. 2 | 16929656 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/25/9.row2_col4.txt: -------------------------------------------------------------------------------- 1 | To continue, please consult the code grid in the manual. Enter the code at row 2, column 4. 2 | 7726640 3 | - 4 | -------------------------------------------------------------------------------- /tests/2015/test_10_elves_look_elves_say.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2015.q10 import look_and_say 2 | 3 | 4 | def test_look_and_say_examples(): 5 | assert look_and_say("211") == "1221" 6 | assert look_and_say("1", n=1) == "11" 7 | assert look_and_say("1", n=2) == "21" 8 | assert look_and_say("1", n=3) == "1211" 9 | assert look_and_say("1", n=4) == "111221" 10 | assert look_and_say("1", n=5) == "312211" 11 | -------------------------------------------------------------------------------- /tests/2015/test_11_corporate_policy.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2015 import q11 2 | 3 | 4 | def test_requirements(): 5 | assert q11.req1("hijklmmn") 6 | assert not q11.req2("hijklmmn") 7 | assert q11.req3("abbceffg") 8 | assert not q11.req1("abbceffg") 9 | assert not q11.req3("abbcegjk") 10 | -------------------------------------------------------------------------------- /tests/2015/test_20_infinite_elves_and_infinite_houses.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from parse import parse 3 | 4 | 5 | expected = """\ 6 | House 1 got 10 presents. 7 | House 2 got 30 presents. 8 | House 3 got 40 presents. 9 | House 4 got 70 presents. 10 | House 5 got 60 presents. 11 | House 6 got 120 presents. 12 | House 7 got 80 presents. 13 | House 8 got 150 presents. 14 | House 9 got 130 presents.""" 15 | 16 | 17 | @pytest.mark.parametrize("line", expected.splitlines()) 18 | def test_first_nine_houses_on_the_street_slow(line): 19 | from aoc_wim.aoc2015 import q20 # inline import because the module is slow to load 20 | i, n = parse("House {:d} got {:d} presents.", line).fixed 21 | assert q20.A[i] == n 22 | -------------------------------------------------------------------------------- /tests/2015/test_21_rpg_simulator_20xx.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2015 import q21 2 | 3 | 4 | def test_battle(): 5 | player = q21.Player(name="player", hp=8, damage=5, armor=5) 6 | boss = q21.Player(name="boss", hp=12, damage=7, armor=2) 7 | winner = q21.battle_winner(attacker=player, defender=boss) 8 | assert winner is player 9 | assert winner.hp == 2 10 | -------------------------------------------------------------------------------- /tests/2015/test_23_opening_the_turing_lock.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2015 import q23 2 | 3 | data = """\ 4 | inc a 5 | jio a, +2 6 | tpl a 7 | inc a 8 | """ 9 | 10 | 11 | def test_simple_jump(): 12 | computer = q23.Computer(instructions=data) 13 | computer.compute() 14 | assert computer.registers["a"] == 2 15 | -------------------------------------------------------------------------------- /tests/2016/01/0.txt: -------------------------------------------------------------------------------- 1 | R2, L3 2 | 5 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/01/1.txt: -------------------------------------------------------------------------------- 1 | R2, R2, R2 2 | 2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/01/2.txt: -------------------------------------------------------------------------------- 1 | R5, L5, R5, R3 2 | 12 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/01/3.txt: -------------------------------------------------------------------------------- 1 | R8, R4, R4, R8 2 | - 3 | 4 4 | -------------------------------------------------------------------------------- /tests/2016/02/0.txt: -------------------------------------------------------------------------------- 1 | ULL 2 | RRDDD 3 | LURDL 4 | UUUUD 5 | 1985 6 | 5DB3 7 | -------------------------------------------------------------------------------- /tests/2016/03/0.txt: -------------------------------------------------------------------------------- 1 | 5 10 25 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/04/0.txt: -------------------------------------------------------------------------------- 1 | aaaaa-bbb-z-y-x-123[abxyz] 2 | a-b-c-d-e-f-g-h-987[abcde] 3 | not-a-real-room-404[oarel] 4 | totally-real-room-200[decoy] 5 | 1514 6 | - 7 | -------------------------------------------------------------------------------- /tests/2016/05/0.slow.txt: -------------------------------------------------------------------------------- 1 | abc 2 | 18f47a30 3 | 05ace8e3 4 | -------------------------------------------------------------------------------- /tests/2016/06/0.txt: -------------------------------------------------------------------------------- 1 | eedadn 2 | drvtee 3 | eandsr 4 | raavrd 5 | atevrs 6 | tsrnev 7 | sdttsa 8 | rasrtv 9 | nssdts 10 | ntnada 11 | svetve 12 | tesnvt 13 | vntsnd 14 | vrdear 15 | dvrsen 16 | enarar 17 | easter 18 | advent 19 | -------------------------------------------------------------------------------- /tests/2016/07/0.txt: -------------------------------------------------------------------------------- 1 | abba[mnop]qrst 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/07/1.txt: -------------------------------------------------------------------------------- 1 | abcd[bddb]xyyx 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/07/2.txt: -------------------------------------------------------------------------------- 1 | aaaa[qwer]tyui 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/07/3.txt: -------------------------------------------------------------------------------- 1 | ioxxoj[asdfgh]zxcvbn 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/07/4.txt: -------------------------------------------------------------------------------- 1 | aba[bab]xyz 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2016/07/5.txt: -------------------------------------------------------------------------------- 1 | xyx[xyx]xyx 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2016/07/6.txt: -------------------------------------------------------------------------------- 1 | aaa[kek]eke 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2016/07/7.txt: -------------------------------------------------------------------------------- 1 | zazbz[bzb]cdb 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2016/08/0.txt: -------------------------------------------------------------------------------- 1 | rect 3x2 2 | rotate column x=1 by 1 3 | rotate row y=0 by 4 4 | rotate column x=1 by 1 5 | 6 # screen_height=3, screen_width=7 6 | - 7 | -------------------------------------------------------------------------------- /tests/2016/09/0.txt: -------------------------------------------------------------------------------- 1 | ADVENT 2 | 6 # len("ADVENT") 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/09/1.txt: -------------------------------------------------------------------------------- 1 | A(1x5)BC 2 | 7 # len("ABBBBBC") 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/09/2.txt: -------------------------------------------------------------------------------- 1 | (3x3)XYZ 2 | 9 # len("XYZXYZXYZ") 3 | 9 4 | -------------------------------------------------------------------------------- /tests/2016/09/3.txt: -------------------------------------------------------------------------------- 1 | A(2x2)BCD(2x2)EFG 2 | 11 # len("ABCBCDEFEFG") 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/09/4.txt: -------------------------------------------------------------------------------- 1 | (6x1)(1x3)A 2 | 6 # len("(1x3)A") 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/09/5.txt: -------------------------------------------------------------------------------- 1 | X(8x2)(3x3)ABCY 2 | 18 # len("X(3x3)ABC(3x3)ABCY") 3 | 20 # len("XABCABCABCABCABCABCY") 4 | -------------------------------------------------------------------------------- /tests/2016/09/6.txt: -------------------------------------------------------------------------------- 1 | (27x12)(20x12)(13x14)(7x10)(1x12)A 2 | - 3 | 241920 # 12 * 12 * 14 * 10 * 12 4 | -------------------------------------------------------------------------------- /tests/2016/09/7.txt: -------------------------------------------------------------------------------- 1 | (25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN 2 | - 3 | 445 4 | -------------------------------------------------------------------------------- /tests/2016/09/reddit.1.txt: -------------------------------------------------------------------------------- 1 | (6x2)(2x2)AB 2 | 13 # len("(2x2)A(2x2)AB") 3 | 7 # len("A(AABAB") 4 | 5 | # user example from reddit 6 | # https://www.reddit.com/r/adventofcode/comments/5hbygy/2016_day_9_solutions/dazbjjb 7 | # another marker over-reaching input 8 | # note that the example solution shown there A(A(ABAB has an off-by-one error 9 | -------------------------------------------------------------------------------- /tests/2016/09/reddit.2.txt: -------------------------------------------------------------------------------- 1 | (5x2))(2x1 2 | 10 # len(")(2x1)(2x1") 3 | 5 # len(")(2x1") 4 | 5 | # user example from reddit 6 | # https://www.reddit.com/r/adventofcode/comments/5xk7s1/2016_day_9_part_2_what_to_do_with_5x22x1/ 7 | # this one is interesting because it reconstructs a broken marker 8 | -------------------------------------------------------------------------------- /tests/2016/09/topaz.1.txt: -------------------------------------------------------------------------------- 1 | AAA(4x3)BBB 2 | - 3 | 12 # len("AAABBBBBBBBB") 4 | 5 | # this is an additional example verified by the AoC author on reddit (topaz2078) 6 | # https://www.reddit.com/r/adventofcode/comments/5hh56d/help_dont_understand_puzzle_9_part_b/db0aggl 7 | -------------------------------------------------------------------------------- /tests/2016/09/topaz.2.txt: -------------------------------------------------------------------------------- 1 | (7x2)A(3x2)BCD 2 | - 3 | 12 # len("ABA(BABCDBCD") == 12 4 | 5 | # this is an additional example verified by the AoC author on reddit (topaz2078) 6 | # https://www.reddit.com/r/adventofcode/comments/5hh56d/help_dont_understand_puzzle_9_part_b/db0aggl 7 | # The first marker is copying another marker which wants to access something outside of the first marker's reach 8 | -------------------------------------------------------------------------------- /tests/2016/09/wim.txt: -------------------------------------------------------------------------------- 1 | (4x2)AA(3x2)BCD 2 | 14 # len("AA(3AA(3x2)BCD") 3 | 12 # len("AA(3AABCDBCD") 4 | 5 | # splits a marker 6 | -------------------------------------------------------------------------------- /tests/2016/10/0.txt: -------------------------------------------------------------------------------- 1 | value 5 goes to bot 2 2 | bot 2 gives low to bot 1 and high to bot 0 3 | value 3 goes to bot 1 4 | bot 1 gives low to output 1 and high to bot 0 5 | bot 0 gives low to output 2 and high to output 0 6 | value 2 goes to bot 2 7 | 2 # chip1=5,chip2=2 8 | - 9 | -------------------------------------------------------------------------------- /tests/2016/11/0.txt: -------------------------------------------------------------------------------- 1 | The first floor contains a hydrogen-compatible microchip and a lithium-compatible microchip. 2 | The second floor contains a hydrogen generator. 3 | The third floor contains a lithium generator. 4 | The fourth floor contains nothing relevant. 5 | 11 6 | - 7 | -------------------------------------------------------------------------------- /tests/2016/12/0.txt: -------------------------------------------------------------------------------- 1 | cpy 41 a 2 | inc a 3 | inc a 4 | dec a 5 | jnz a 2 6 | dec a 7 | 42 8 | - 9 | -------------------------------------------------------------------------------- /tests/2016/13/0.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/14/0.slow.txt: -------------------------------------------------------------------------------- 1 | abc 2 | 22728 3 | 22551 4 | -------------------------------------------------------------------------------- /tests/2016/15/0.txt: -------------------------------------------------------------------------------- 1 | Disc #1 has 5 positions; at time=0, it is at position 4. 2 | Disc #2 has 2 positions; at time=0, it is at position 1. 3 | 5 4 | - 5 | -------------------------------------------------------------------------------- /tests/2016/16/0.txt: -------------------------------------------------------------------------------- 1 | 110010110100 2 | 100 # disk_length=12 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/16/1.txt: -------------------------------------------------------------------------------- 1 | 10000 2 | 01100 # disk_length=20 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/17/0.txt: -------------------------------------------------------------------------------- 1 | ihgpwlah 2 | DDRRRD 3 | 370 4 | -------------------------------------------------------------------------------- /tests/2016/17/1.txt: -------------------------------------------------------------------------------- 1 | kglvqrro 2 | DDUDRLRRUDRD 3 | 492 4 | -------------------------------------------------------------------------------- /tests/2016/17/2.txt: -------------------------------------------------------------------------------- 1 | ulqzkmiv 2 | DRURDRUDDLLDLUURRDULRLDUUDDDRR 3 | 830 4 | -------------------------------------------------------------------------------- /tests/2016/18/0.txt: -------------------------------------------------------------------------------- 1 | ..^^. 2 | 6 # n_rows=3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/18/1.txt: -------------------------------------------------------------------------------- 1 | .^^.^.^^^^ 2 | 38 # n_rows=10 3 | - 4 | -------------------------------------------------------------------------------- /tests/2016/19/0.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 3 3 | 2 4 | -------------------------------------------------------------------------------- /tests/2016/20/0.txt: -------------------------------------------------------------------------------- 1 | 5-8 2 | 0-2 3 | 4-7 4 | 3 # max_val=9 5 | 2 6 | -------------------------------------------------------------------------------- /tests/2016/21/0.txt: -------------------------------------------------------------------------------- 1 | swap position 4 with position 0 2 | swap letter d with letter b 3 | reverse positions 0 through 4 4 | rotate left 1 step 5 | move position 1 to position 4 6 | move position 3 to position 0 7 | rotate based on position of letter b 8 | rotate based on position of letter d 9 | decab # start=abcde 10 | - 11 | -------------------------------------------------------------------------------- /tests/2016/22/0.txt: -------------------------------------------------------------------------------- 1 | Filesystem Size Used Avail Use% 2 | /dev/grid/node-x0-y0 10T 8T 2T 80% 3 | /dev/grid/node-x0-y1 11T 6T 5T 54% 4 | /dev/grid/node-x0-y2 32T 28T 4T 87% 5 | /dev/grid/node-x1-y0 9T 7T 2T 77% 6 | /dev/grid/node-x1-y1 8T 0T 8T 0% 7 | /dev/grid/node-x1-y2 11T 7T 4T 63% 8 | /dev/grid/node-x2-y0 10T 6T 4T 60% 9 | /dev/grid/node-x2-y1 9T 8T 1T 88% 10 | /dev/grid/node-x2-y2 9T 6T 3T 66% 11 | - 12 | 7 13 | -------------------------------------------------------------------------------- /tests/2016/23/0.txt: -------------------------------------------------------------------------------- 1 | cpy 2 a 2 | tgl a 3 | tgl a 4 | tgl a 5 | cpy 1 a 6 | dec a 7 | dec a 8 | 3 9 | - 10 | -------------------------------------------------------------------------------- /tests/2016/24/0.txt: -------------------------------------------------------------------------------- 1 | ########### 2 | #0.1.....2# 3 | #.#######.# 4 | #4.......3# 5 | ########### 6 | 14 7 | 20 8 | -------------------------------------------------------------------------------- /tests/2016/test_04_security_through_obscurity.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2016 import q04 2 | 3 | 4 | def test_decrytion(): 5 | assert q04.decrypt_name("qzmt-zixmtkozy-ivhz", 343) == "very encrypted name" 6 | -------------------------------------------------------------------------------- /tests/2016/test_16_dragon_checksum.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2016 import q16 2 | 3 | 4 | padding = """\ 5 | 1 becomes 100. 6 | 0 becomes 001. 7 | 11111 becomes 11111000000. 8 | 111100001010 becomes 1111000010100101011110000. 9 | 10000 becomes 10000011110. 10 | 10000011110 becomes 10000011110010000111110. 11 | """ 12 | 13 | 14 | def test_padding(): 15 | for line in padding.splitlines(): 16 | left, right = line.rstrip(".").split(" becomes ") 17 | assert q16.pad(left, n=len(right)) == right 18 | -------------------------------------------------------------------------------- /tests/2016/test_17_two_steps_forward.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2016 import q17 2 | 3 | 4 | def test_no_path(): 5 | assert q17.bfs("hijkl", part="a") is None 6 | assert q17.bfs("hijkl", part="b") is None 7 | -------------------------------------------------------------------------------- /tests/2017/01/0.txt: -------------------------------------------------------------------------------- 1 | 1122 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/01/1.txt: -------------------------------------------------------------------------------- 1 | 1111 2 | 4 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/01/2.txt: -------------------------------------------------------------------------------- 1 | 1234 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/01/3.txt: -------------------------------------------------------------------------------- 1 | 91212129 2 | 9 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/01/4.txt: -------------------------------------------------------------------------------- 1 | 1212 2 | - 3 | 6 4 | -------------------------------------------------------------------------------- /tests/2017/01/5.txt: -------------------------------------------------------------------------------- 1 | 1221 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2017/01/6.txt: -------------------------------------------------------------------------------- 1 | 123425 2 | - 3 | 4 4 | -------------------------------------------------------------------------------- /tests/2017/01/7.txt: -------------------------------------------------------------------------------- 1 | 123123 2 | - 3 | 12 4 | -------------------------------------------------------------------------------- /tests/2017/01/8.txt: -------------------------------------------------------------------------------- 1 | 12131415 2 | - 3 | 4 4 | -------------------------------------------------------------------------------- /tests/2017/02/0.txt: -------------------------------------------------------------------------------- 1 | 5 1 9 5 2 | 7 5 3 3 | 2 4 6 8 4 | 18 5 | - 6 | -------------------------------------------------------------------------------- /tests/2017/02/1.txt: -------------------------------------------------------------------------------- 1 | 5 9 2 8 2 | 9 4 7 3 3 | 3 8 6 5 4 | - 5 | 9 6 | -------------------------------------------------------------------------------- /tests/2017/03/0.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/03/1.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/03/2.txt: -------------------------------------------------------------------------------- 1 | 23 2 | 2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/03/3.txt: -------------------------------------------------------------------------------- 1 | 1024 2 | 31 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/04/0.txt: -------------------------------------------------------------------------------- 1 | aa bb cc dd ee 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/04/1.txt: -------------------------------------------------------------------------------- 1 | aa bb cc dd aa 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/04/2.txt: -------------------------------------------------------------------------------- 1 | aa bb cc dd aaa 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/04/3.txt: -------------------------------------------------------------------------------- 1 | abcde fghij 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2017/04/4.txt: -------------------------------------------------------------------------------- 1 | abcde xyz ecdab 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2017/04/5.txt: -------------------------------------------------------------------------------- 1 | a ab abc abd abf abj 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2017/04/6.txt: -------------------------------------------------------------------------------- 1 | iiii oiii ooii oooi oooo 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2017/04/7.txt: -------------------------------------------------------------------------------- 1 | oiii ioii iioi iiio 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2017/05/0.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3 3 | 0 4 | 1 5 | -3 6 | 5 7 | 10 8 | -------------------------------------------------------------------------------- /tests/2017/06/0.txt: -------------------------------------------------------------------------------- 1 | 0 2 7 0 2 | 5 3 | 4 4 | -------------------------------------------------------------------------------- /tests/2017/07/0.txt: -------------------------------------------------------------------------------- 1 | pbga (66) 2 | xhth (57) 3 | ebii (61) 4 | havc (66) 5 | ktlj (57) 6 | fwft (72) -> ktlj, cntj, xhth 7 | qoyq (66) 8 | padx (45) -> pbga, havc, qoyq 9 | tknk (41) -> ugml, padx, fwft 10 | jptl (61) 11 | ugml (68) -> gyxo, ebii, jptl 12 | gyxo (61) 13 | cntj (57) 14 | tknk 15 | 60 16 | -------------------------------------------------------------------------------- /tests/2017/08/0.txt: -------------------------------------------------------------------------------- 1 | b inc 5 if a > 1 2 | a inc 1 if b < 5 3 | c dec -10 if a >= 1 4 | c inc -20 if c == 10 5 | 1 6 | 10 7 | -------------------------------------------------------------------------------- /tests/2017/09/0.txt: -------------------------------------------------------------------------------- 1 | {} 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/1.txt: -------------------------------------------------------------------------------- 1 | {{{}}} 2 | 6 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/10.txt: -------------------------------------------------------------------------------- 1 | <<<<> 2 | - 3 | 3 4 | -------------------------------------------------------------------------------- /tests/2017/09/11.txt: -------------------------------------------------------------------------------- 1 | <{!>}> 2 | - 3 | 2 4 | -------------------------------------------------------------------------------- /tests/2017/09/12.txt: -------------------------------------------------------------------------------- 1 | 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2017/09/13.txt: -------------------------------------------------------------------------------- 1 | > 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2017/09/14.txt: -------------------------------------------------------------------------------- 1 | <{o"i!a,<{i 2 | - 3 | 10 4 | -------------------------------------------------------------------------------- /tests/2017/09/2.txt: -------------------------------------------------------------------------------- 1 | {{},{}} 2 | 5 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/3.txt: -------------------------------------------------------------------------------- 1 | {{{},{},{{}}}} 2 | 16 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/4.txt: -------------------------------------------------------------------------------- 1 | {,,,} 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/5.txt: -------------------------------------------------------------------------------- 1 | {{},{},{},{}} 2 | 9 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/6.txt: -------------------------------------------------------------------------------- 1 | {{},{},{},{}} 2 | 9 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/7.txt: -------------------------------------------------------------------------------- 1 | {{},{},{},{}} 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/09/8.txt: -------------------------------------------------------------------------------- 1 | <> 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2017/09/9.txt: -------------------------------------------------------------------------------- 1 | 2 | - 3 | 17 4 | -------------------------------------------------------------------------------- /tests/2017/10/0.txt: -------------------------------------------------------------------------------- 1 | 3, 4, 1, 5 2 | 12 # n=5 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/10/1.txt: -------------------------------------------------------------------------------- 1 | 2 | - 3 | a2582a3a0e66e6e86e3812dcb672a272 4 | -------------------------------------------------------------------------------- /tests/2017/10/2.txt: -------------------------------------------------------------------------------- 1 | AoC 2017 2 | - 3 | 33efeb34ea91902bb2f59c9920caa6cd 4 | -------------------------------------------------------------------------------- /tests/2017/10/3.txt: -------------------------------------------------------------------------------- 1 | 1,2,3 2 | - 3 | 3efbe78a8d82f29979031a4aa0b16a9d 4 | -------------------------------------------------------------------------------- /tests/2017/10/4.txt: -------------------------------------------------------------------------------- 1 | 1,2,4 2 | - 3 | 63960835bcdc130f0b66d7ff4f6a5a8e 4 | -------------------------------------------------------------------------------- /tests/2017/11/0.txt: -------------------------------------------------------------------------------- 1 | ne,ne,ne 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/11/1.txt: -------------------------------------------------------------------------------- 1 | ne,ne,sw,sw 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/11/2.txt: -------------------------------------------------------------------------------- 1 | ne,ne,s,s 2 | 2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/11/3.txt: -------------------------------------------------------------------------------- 1 | se,sw,se,sw,sw 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/12/0.txt: -------------------------------------------------------------------------------- 1 | 0 <-> 2 2 | 1 <-> 1 3 | 2 <-> 0, 3, 4 4 | 3 <-> 2, 4 5 | 4 <-> 2, 3, 6 6 | 5 <-> 6 7 | 6 <-> 4, 5 8 | 6 9 | 2 10 | -------------------------------------------------------------------------------- /tests/2017/13/0.txt: -------------------------------------------------------------------------------- 1 | 0: 3 2 | 1: 2 3 | 4: 4 4 | 6: 4 5 | 24 6 | 10 7 | -------------------------------------------------------------------------------- /tests/2017/14/0.slow.txt: -------------------------------------------------------------------------------- 1 | flqrgnkx 2 | 8108 3 | 1242 4 | -------------------------------------------------------------------------------- /tests/2017/15/0.slow.txt: -------------------------------------------------------------------------------- 1 | Generator A starts with 65 2 | Generator B starts with 8921 3 | 588 4 | 309 5 | -------------------------------------------------------------------------------- /tests/2017/16/0.txt: -------------------------------------------------------------------------------- 1 | s1,x3/4,pe/b 2 | baedc 3 | ceadb # n_programs=5,iterations=2 4 | -------------------------------------------------------------------------------- /tests/2017/17/0.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 638 3 | - 4 | -------------------------------------------------------------------------------- /tests/2017/18/0.txt: -------------------------------------------------------------------------------- 1 | set a 1 2 | add a 2 3 | mul a a 4 | mod a 5 5 | snd a 6 | set a 0 7 | rcv a 8 | jgz a -1 9 | set a 1 10 | jgz a -2 11 | 4 12 | - 13 | -------------------------------------------------------------------------------- /tests/2017/18/1.txt: -------------------------------------------------------------------------------- 1 | snd 1 2 | snd 2 3 | snd p 4 | rcv a 5 | rcv b 6 | rcv c 7 | rcv d 8 | - 9 | 3 10 | -------------------------------------------------------------------------------- /tests/2017/19/0.txt: -------------------------------------------------------------------------------- 1 | | 2 | | +--+ 3 | A | C 4 | F---|----E|--+ 5 | | | | D 6 | +B-+ +--+ 7 | 8 | ABCDEF 9 | 38 10 | -------------------------------------------------------------------------------- /tests/2017/20/0.txt: -------------------------------------------------------------------------------- 1 | p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0> 2 | p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0> 3 | 0 4 | - 5 | -------------------------------------------------------------------------------- /tests/2017/20/1.txt: -------------------------------------------------------------------------------- 1 | p=<-6,0,0>, v=< 3,0,0>, a=< 0,0,0> 2 | p=<-4,0,0>, v=< 2,0,0>, a=< 0,0,0> 3 | p=<-2,0,0>, v=< 1,0,0>, a=< 0,0,0> 4 | p=< 3,0,0>, v=<-1,0,0>, a=< 0,0,0> 5 | - 6 | 1 7 | -------------------------------------------------------------------------------- /tests/2017/21/0.txt: -------------------------------------------------------------------------------- 1 | ../.# => ##./#../... 2 | .#./..#/### => #..#/..../..../#..# 3 | 12 # iterations=2 4 | - 5 | -------------------------------------------------------------------------------- /tests/2017/22/0.txt: -------------------------------------------------------------------------------- 1 | ..# 2 | #.. 3 | ... 4 | 5 # iterations=7 5 | - 6 | -------------------------------------------------------------------------------- /tests/2017/22/1.txt: -------------------------------------------------------------------------------- 1 | ..# 2 | #.. 3 | ... 4 | 41 # iterations=70 5 | - 6 | -------------------------------------------------------------------------------- /tests/2017/22/2.slow.txt: -------------------------------------------------------------------------------- 1 | ..# 2 | #.. 3 | ... 4 | 5587 5 | 2511944 6 | -------------------------------------------------------------------------------- /tests/2017/22/3.txt: -------------------------------------------------------------------------------- 1 | ..# 2 | #.. 3 | ... 4 | - 5 | 26 # iterations=100 6 | -------------------------------------------------------------------------------- /tests/2017/24/0.txt: -------------------------------------------------------------------------------- 1 | 0/2 2 | 2/2 3 | 2/3 4 | 3/4 5 | 3/5 6 | 0/1 7 | 10/1 8 | 9/10 9 | 31 10 | 19 11 | -------------------------------------------------------------------------------- /tests/2017/25/0.txt: -------------------------------------------------------------------------------- 1 | Begin in state A. 2 | Perform a diagnostic checksum after 6 steps. 3 | 4 | In state A: 5 | If the current value is 0: 6 | - Write the value 1. 7 | - Move one slot to the right. 8 | - Continue with state B. 9 | If the current value is 1: 10 | - Write the value 0. 11 | - Move one slot to the left. 12 | - Continue with state B. 13 | 14 | In state B: 15 | If the current value is 0: 16 | - Write the value 1. 17 | - Move one slot to the left. 18 | - Continue with state A. 19 | If the current value is 1: 20 | - Write the value 1. 21 | - Move one slot to the right. 22 | - Continue with state A. 23 | 3 24 | - 25 | -------------------------------------------------------------------------------- /tests/2017/test_03_spiral_memory.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2017.q03 import gen 2 | 3 | example_sums = [ 4 | 1, 5 | 1, 6 | 2, 7 | 4, 8 | 5, 9 | 10, 10 | 11, 11 | 23, 12 | 25, 13 | 26, 14 | 54, 15 | 57, 16 | 59, 17 | 122, 18 | 133, 19 | 142, 20 | 147, 21 | 304, 22 | 330, 23 | 351, 24 | 362, 25 | 747, 26 | 806, 27 | ] 28 | 29 | 30 | def test_example_spiral(): 31 | g = gen() 32 | actual = [next(g)[1] for _ in example_sums] 33 | assert actual == example_sums 34 | -------------------------------------------------------------------------------- /tests/2017/test_05_a_maze_of_twisty_trampolines_all_alike.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2017 import q05 2 | 3 | 4 | def test_final_state_a(): 5 | q05.part_a("0 3 0 1 -3") 6 | assert q05.part_a.final_state == [2, 5, 0, 1, -2] 7 | 8 | 9 | def test_final_state_b(): 10 | q05.part_b("0 3 0 1 -3") 11 | assert q05.part_a.final_state == [2, 3, 2, 3, -1] 12 | -------------------------------------------------------------------------------- /tests/2018/01/0.txt: -------------------------------------------------------------------------------- 1 | +1, -2, +3, +1 2 | 3 3 | 2 4 | -------------------------------------------------------------------------------- /tests/2018/01/1.txt: -------------------------------------------------------------------------------- 1 | +1, +1, +1 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/01/2.txt: -------------------------------------------------------------------------------- 1 | +1, +1, -2 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/01/3.txt: -------------------------------------------------------------------------------- 1 | -1, -2, -3 2 | -6 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/01/4.txt: -------------------------------------------------------------------------------- 1 | +1, -1 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2018/01/5.txt: -------------------------------------------------------------------------------- 1 | +3, +3, +4, -2, -4 2 | - 3 | 10 4 | -------------------------------------------------------------------------------- /tests/2018/01/6.txt: -------------------------------------------------------------------------------- 1 | -6, +3, +8, +5, -6 2 | - 3 | 5 4 | -------------------------------------------------------------------------------- /tests/2018/01/7.txt: -------------------------------------------------------------------------------- 1 | +7, +7, -2, -7, -4 2 | - 3 | 14 4 | -------------------------------------------------------------------------------- /tests/2018/02/0.txt: -------------------------------------------------------------------------------- 1 | abcdef 2 | bababc 3 | abbcde 4 | abcccd 5 | aabcdd 6 | abcdee 7 | ababab 8 | 12 9 | - 10 | -------------------------------------------------------------------------------- /tests/2018/02/1.txt: -------------------------------------------------------------------------------- 1 | abcde 2 | fghij 3 | klmno 4 | pqrst 5 | fguij 6 | axcye 7 | wvxyz 8 | - 9 | fgij 10 | -------------------------------------------------------------------------------- /tests/2018/03/0.txt: -------------------------------------------------------------------------------- 1 | #1 @ 1,3: 4x4 2 | #2 @ 3,1: 4x4 3 | #3 @ 5,5: 2x2 4 | 4 5 | 3 6 | -------------------------------------------------------------------------------- /tests/2018/04/0.txt: -------------------------------------------------------------------------------- 1 | [1518-11-01 00:00] Guard #10 begins shift 2 | [1518-11-01 00:05] falls asleep 3 | [1518-11-01 00:25] wakes up 4 | [1518-11-01 00:30] falls asleep 5 | [1518-11-01 00:55] wakes up 6 | [1518-11-01 23:58] Guard #99 begins shift 7 | [1518-11-02 00:40] falls asleep 8 | [1518-11-02 00:50] wakes up 9 | [1518-11-03 00:05] Guard #10 begins shift 10 | [1518-11-03 00:24] falls asleep 11 | [1518-11-03 00:29] wakes up 12 | [1518-11-04 00:02] Guard #99 begins shift 13 | [1518-11-04 00:36] falls asleep 14 | [1518-11-04 00:46] wakes up 15 | [1518-11-05 00:03] Guard #99 begins shift 16 | [1518-11-05 00:45] falls asleep 17 | [1518-11-05 00:55] wakes up 18 | 240 19 | 4455 20 | -------------------------------------------------------------------------------- /tests/2018/05/0.txt: -------------------------------------------------------------------------------- 1 | aA 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/05/1.txt: -------------------------------------------------------------------------------- 1 | abBA 2 | 0 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/05/2.txt: -------------------------------------------------------------------------------- 1 | abAB 2 | 4 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/05/3.txt: -------------------------------------------------------------------------------- 1 | aabAAB 2 | 6 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/05/4.txt: -------------------------------------------------------------------------------- 1 | dabAcCaCBAcCcaDA 2 | 10 3 | 4 4 | -------------------------------------------------------------------------------- /tests/2018/06/0.txt: -------------------------------------------------------------------------------- 1 | 1, 1 2 | 1, 6 3 | 8, 3 4 | 3, 4 5 | 5, 5 6 | 8, 9 7 | 17 8 | 16 9 | -------------------------------------------------------------------------------- /tests/2018/07/0.txt: -------------------------------------------------------------------------------- 1 | Step C must be finished before step A can begin. 2 | Step C must be finished before step F can begin. 3 | Step A must be finished before step B can begin. 4 | Step A must be finished before step D can begin. 5 | Step B must be finished before step E can begin. 6 | Step D must be finished before step E can begin. 7 | Step F must be finished before step E can begin. 8 | CABDFE 9 | 15 # delay=0,n_workers=2 10 | -------------------------------------------------------------------------------- /tests/2018/08/0.txt: -------------------------------------------------------------------------------- 1 | 2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2 2 | 138 3 | 66 4 | -------------------------------------------------------------------------------- /tests/2018/09/0.txt: -------------------------------------------------------------------------------- 1 | 9 players; last marble is worth 25 points 2 | 32 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/09/1.txt: -------------------------------------------------------------------------------- 1 | 10 players; last marble is worth 1618 points 2 | 8317 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/09/2.txt: -------------------------------------------------------------------------------- 1 | 13 players; last marble is worth 7999 points 2 | 146373 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/09/3.txt: -------------------------------------------------------------------------------- 1 | 17 players; last marble is worth 1104 points 2 | 2764 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/09/4.txt: -------------------------------------------------------------------------------- 1 | 21 players; last marble is worth 6111 points 2 | 54718 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/09/5.txt: -------------------------------------------------------------------------------- 1 | 30 players; last marble is worth 5807 points 2 | 37305 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/11/0.txt: -------------------------------------------------------------------------------- 1 | 18 2 | 33,45 3 | 90,269,16 4 | -------------------------------------------------------------------------------- /tests/2018/11/1.txt: -------------------------------------------------------------------------------- 1 | 42 2 | 21,61 3 | 232,251,12 4 | -------------------------------------------------------------------------------- /tests/2018/12/0.txt: -------------------------------------------------------------------------------- 1 | initial state: #..#.#..##......###...### 2 | 3 | ...## => # 4 | ..#.. => # 5 | .#... => # 6 | .#.#. => # 7 | .#.## => # 8 | .##.. => # 9 | .#### => # 10 | #.#.# => # 11 | #.### => # 12 | ##.#. => # 13 | ##.## => # 14 | ###.. => # 15 | ###.# => # 16 | ####. => # 17 | 325 18 | - 19 | -------------------------------------------------------------------------------- /tests/2018/13/0.txt: -------------------------------------------------------------------------------- 1 | | 2 | v 3 | | 4 | | 5 | | 6 | ^ 7 | | 8 | 0,3 9 | - 10 | -------------------------------------------------------------------------------- /tests/2018/13/1.txt: -------------------------------------------------------------------------------- 1 | /->-\ 2 | | | /----\ 3 | | /-+--+-\ | 4 | | | | | v | 5 | \-+-/ \-+--/ 6 | \------/ 7 | 7,3 8 | - 9 | -------------------------------------------------------------------------------- /tests/2018/13/2.txt: -------------------------------------------------------------------------------- 1 | />-<\ 2 | | | 3 | | /<+-\ 4 | | | | v 5 | \>+/ 8 | - 9 | 6,4 10 | -------------------------------------------------------------------------------- /tests/2018/14/0.txt: -------------------------------------------------------------------------------- 1 | 9 2 | 5158916779 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/14/1.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 0124515891 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/14/2.txt: -------------------------------------------------------------------------------- 1 | 18 2 | 9251071085 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/14/3.txt: -------------------------------------------------------------------------------- 1 | 2018 2 | 5941429882 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/14/4.txt: -------------------------------------------------------------------------------- 1 | 5158916779 2 | - 3 | 9 4 | -------------------------------------------------------------------------------- /tests/2018/14/5.txt: -------------------------------------------------------------------------------- 1 | 0124515891 2 | - 3 | 5 4 | -------------------------------------------------------------------------------- /tests/2018/14/6.txt: -------------------------------------------------------------------------------- 1 | 9251071085 2 | - 3 | 18 4 | -------------------------------------------------------------------------------- /tests/2018/14/7.txt: -------------------------------------------------------------------------------- 1 | 5941429882 2 | - 3 | 2018 4 | -------------------------------------------------------------------------------- /tests/2018/15/0.txt: -------------------------------------------------------------------------------- 1 | ####### 2 | #.G...# 3 | #...EG# 4 | #.#.#G# 5 | #..G#E# 6 | #.....# 7 | ####### 8 | 27730 9 | 4988 10 | -------------------------------------------------------------------------------- /tests/2018/15/1.txt: -------------------------------------------------------------------------------- 1 | ####### 2 | #G..#E# 3 | #E#E.E# 4 | #G.##.# 5 | #...#E# 6 | #...E.# 7 | ####### 8 | 36334 9 | - 10 | -------------------------------------------------------------------------------- /tests/2018/15/2.txt: -------------------------------------------------------------------------------- 1 | ####### 2 | #E..EG# 3 | #.#G.E# 4 | #E.##E# 5 | #G..#.# 6 | #..E#.# 7 | ####### 8 | 39514 9 | 31284 10 | -------------------------------------------------------------------------------- /tests/2018/15/3.txt: -------------------------------------------------------------------------------- 1 | ####### 2 | #E.G#.# 3 | #.#G..# 4 | #G.#.G# 5 | #G..#.# 6 | #...E.# 7 | ####### 8 | 27755 9 | 3478 10 | -------------------------------------------------------------------------------- /tests/2018/15/4.txt: -------------------------------------------------------------------------------- 1 | ####### 2 | #.E...# 3 | #.#..G# 4 | #.###.# 5 | #E#G#G# 6 | #...#G# 7 | ####### 8 | 28944 9 | 6474 10 | -------------------------------------------------------------------------------- /tests/2018/15/5.txt: -------------------------------------------------------------------------------- 1 | ######### 2 | #G......# 3 | #.E.#...# 4 | #..##..G# 5 | #...##..# 6 | #...#...# 7 | #.G...G.# 8 | #.....G.# 9 | ######### 10 | 18740 11 | 1140 12 | -------------------------------------------------------------------------------- /tests/2018/16/0.txt: -------------------------------------------------------------------------------- 1 | Before: [3, 2, 1, 1] 2 | 9 2 1 2 3 | After: [3, 2, 2, 1] 4 | 1 5 | - 6 | -------------------------------------------------------------------------------- /tests/2018/17/0.txt: -------------------------------------------------------------------------------- 1 | x=495, y=2..7 2 | y=7, x=495..501 3 | x=501, y=3..7 4 | x=498, y=2..4 5 | x=506, y=1..2 6 | x=498, y=10..13 7 | x=504, y=10..13 8 | y=13, x=498..504 9 | 57 10 | 29 11 | -------------------------------------------------------------------------------- /tests/2018/18/0.txt: -------------------------------------------------------------------------------- 1 | .#.#...|#. 2 | .....#|##| 3 | .|..|...#. 4 | ..|#.....# 5 | #.#|||#|#| 6 | ...#.||... 7 | .|....|... 8 | ||...#|.#| 9 | |.||||..|. 10 | ...#.|..|. 11 | 1147 12 | - 13 | -------------------------------------------------------------------------------- /tests/2018/19/0.txt: -------------------------------------------------------------------------------- 1 | #ip 0 2 | seti 5 0 1 3 | seti 6 0 2 4 | addi 0 1 0 5 | addr 1 2 3 6 | setr 1 0 0 7 | seti 8 0 4 8 | seti 9 0 5 9 | 7 10 | - 11 | -------------------------------------------------------------------------------- /tests/2018/20/0.txt: -------------------------------------------------------------------------------- 1 | ^WNE$ 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/1.txt: -------------------------------------------------------------------------------- 1 | ^ENWWW(NEEE|SSE(EE|N))$ 2 | 10 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/2.txt: -------------------------------------------------------------------------------- 1 | ^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$ 2 | 18 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/3.txt: -------------------------------------------------------------------------------- 1 | ^ESSWWN(E|NNENN(EESS(WNSE|)SSS|WWWSSSSE(SW|NNNE)))$ 2 | 23 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/4.txt: -------------------------------------------------------------------------------- 1 | ^WSSEESWWWNW(S|NENNEEEENN(ESSSSW(NWSW|SSEN)|WSWWN(E|WWS(E|SS))))$ 2 | 31 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/wim.1.txt: -------------------------------------------------------------------------------- 1 | ^(N|S|E|W)$ 2 | 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/wim.2.txt: -------------------------------------------------------------------------------- 1 | ^(N|S|E|W)(N|S|E|W)$ 2 | 2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/wim.3.txt: -------------------------------------------------------------------------------- 1 | ^(N|S|E|W)(N|E|W|S)(W|E|N|S)$ 2 | 3 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/wim.4.txt: -------------------------------------------------------------------------------- 1 | ^E(NN|S)E$ 2 | 4 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/wim.5.txt: -------------------------------------------------------------------------------- 1 | ^(N|S)N$ 2 | 2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/20/wim.6.txt: -------------------------------------------------------------------------------- 1 | ^EEE(NN|SSS)EEE$ 2 | 9 3 | - 4 | -------------------------------------------------------------------------------- /tests/2018/22/0.txt: -------------------------------------------------------------------------------- 1 | depth: 510 2 | target: 10,10 3 | 114 4 | 45 5 | -------------------------------------------------------------------------------- /tests/2018/23/0.txt: -------------------------------------------------------------------------------- 1 | pos=<0,0,0>, r=4 2 | pos=<1,0,0>, r=1 3 | pos=<4,0,0>, r=3 4 | pos=<0,2,0>, r=1 5 | pos=<0,5,0>, r=3 6 | pos=<0,0,3>, r=1 7 | pos=<1,1,1>, r=1 8 | pos=<1,1,2>, r=1 9 | pos=<1,3,1>, r=1 10 | 7 11 | - 12 | -------------------------------------------------------------------------------- /tests/2018/23/1.txt: -------------------------------------------------------------------------------- 1 | pos=<10,12,12>, r=2 2 | pos=<12,14,12>, r=2 3 | pos=<16,12,12>, r=4 4 | pos=<14,14,14>, r=6 5 | pos=<50,50,50>, r=200 6 | pos=<10,10,10>, r=5 7 | - 8 | 36 9 | -------------------------------------------------------------------------------- /tests/2018/24/0.txt: -------------------------------------------------------------------------------- 1 | Immune System: 2 | 17 units each with 5390 hit points (weak to radiation, bludgeoning) with 3 | an attack that does 4507 fire damage at initiative 2 4 | 989 units each with 1274 hit points (immune to fire; weak to bludgeoning, 5 | slashing) with an attack that does 25 slashing damage at initiative 3 6 | 7 | Infection: 8 | 801 units each with 4706 hit points (weak to radiation) with an attack 9 | that does 116 bludgeoning damage at initiative 1 10 | 4485 units each with 2961 hit points (immune to radiation; weak to fire, 11 | cold) with an attack that does 12 slashing damage at initiative 4 12 | 5216 13 | 51 14 | -------------------------------------------------------------------------------- /tests/2018/25/0.txt: -------------------------------------------------------------------------------- 1 | 0,0,0,0 2 | 3,0,0,0 3 | 0,3,0,0 4 | 0,0,3,0 5 | 0,0,0,3 6 | 0,0,0,6 7 | 9,0,0,0 8 | 12,0,0,0 9 | 2 10 | - 11 | -------------------------------------------------------------------------------- /tests/2018/25/1.txt: -------------------------------------------------------------------------------- 1 | -1,2,2,0 2 | 0,0,2,-2 3 | 0,0,0,-2 4 | -1,2,0,0 5 | -2,-2,-2,2 6 | 3,0,2,-1 7 | -1,3,2,2 8 | -1,0,-1,0 9 | 0,2,1,-2 10 | 3,0,0,0 11 | 4 12 | - 13 | -------------------------------------------------------------------------------- /tests/2018/25/2.txt: -------------------------------------------------------------------------------- 1 | 1,-1,0,1 2 | 2,0,-1,0 3 | 3,2,-1,0 4 | 0,0,3,1 5 | 0,0,-1,-1 6 | 2,3,-2,0 7 | -2,2,0,0 8 | 2,-2,0,-1 9 | 1,-1,0,-1 10 | 3,2,0,2 11 | 3 12 | - 13 | -------------------------------------------------------------------------------- /tests/2018/25/3.txt: -------------------------------------------------------------------------------- 1 | 1,-1,-1,-2 2 | -2,-2,0,1 3 | 0,2,1,3 4 | -2,3,-2,1 5 | 0,2,3,-2 6 | -1,-1,1,-2 7 | 0,-2,-1,0 8 | -2,2,3,-1 9 | 1,2,2,0 10 | -1,-2,0,-2 11 | 8 12 | - 13 | -------------------------------------------------------------------------------- /tests/2018/test_05_alchemical_reduction.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from aoc_wim.aoc2018 import q05 4 | 5 | 6 | @pytest.mark.parametrize("polymer,reacted", [ 7 | ("aA", ""), 8 | ("abBA", ""), 9 | ("abAB", "abAB"), 10 | ("aabAAB", "aabAAB"), 11 | ("dabAcCaCBAcCcaDA", "dabCBAcaDA"), 12 | ]) 13 | def test_example_reactions(polymer, reacted): 14 | assert q05.react(polymer) == reacted 15 | 16 | 17 | def test_example_improvements(): 18 | polymer = "dabAcCaCBAcCcaDA" 19 | results = q05.choices(polymer) 20 | assert results == { 21 | "a": "dbCBcD", 22 | "b": "daCAcaDA", 23 | "c": "daDA", 24 | "d": "abCBAc", 25 | } 26 | -------------------------------------------------------------------------------- /tests/2018/test_16_chronal_classification.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2018 import q16 2 | 3 | test_data = """\ 4 | Before: [3, 2, 1, 1] 5 | 9 2 1 2 6 | After: [3, 2, 2, 1]""" 7 | 8 | 9 | def test_choices(): 10 | assert len(q16.choices(test_data)) == 3 11 | assert set(q16.choices(test_data)) == {"mulr", "addi", "seti"} 12 | -------------------------------------------------------------------------------- /tests/2019/01/0.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 2 3 | 2 4 | -------------------------------------------------------------------------------- /tests/2019/01/1.txt: -------------------------------------------------------------------------------- 1 | 14 2 | 2 3 | 2 4 | -------------------------------------------------------------------------------- /tests/2019/01/2.txt: -------------------------------------------------------------------------------- 1 | 1969 2 | 654 3 | 966 4 | -------------------------------------------------------------------------------- /tests/2019/01/3.txt: -------------------------------------------------------------------------------- 1 | 100756 2 | 33583 3 | 50346 4 | -------------------------------------------------------------------------------- /tests/2019/03/0.txt: -------------------------------------------------------------------------------- 1 | R8,U5,L5,D3 2 | U7,R6,D4,L4 3 | 6 4 | 30 5 | -------------------------------------------------------------------------------- /tests/2019/03/1.txt: -------------------------------------------------------------------------------- 1 | R75,D30,R83,U83,L12,D49,R71,U7,L72 2 | U62,R66,U55,R34,D71,R55,D58,R83 3 | 159 4 | 610 5 | -------------------------------------------------------------------------------- /tests/2019/03/2.txt: -------------------------------------------------------------------------------- 1 | R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51 2 | U98,R91,D20,R16,D67,R40,U7,R15,U6,R7 3 | 135 4 | 410 5 | -------------------------------------------------------------------------------- /tests/2019/04/0.txt: -------------------------------------------------------------------------------- 1 | 111111-111111 2 | 1 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2019/04/1.txt: -------------------------------------------------------------------------------- 1 | 223450-223450 2 | 0 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2019/04/2.txt: -------------------------------------------------------------------------------- 1 | 123789-123789 2 | 0 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2019/04/3.txt: -------------------------------------------------------------------------------- 1 | 112233-112233 2 | 1 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2019/04/4.txt: -------------------------------------------------------------------------------- 1 | 123444-123444 2 | 1 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2019/04/5.txt: -------------------------------------------------------------------------------- 1 | 111122-111122 2 | 1 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2019/05/0.txt: -------------------------------------------------------------------------------- 1 | 3,9,8,9,10,9,4,9,99,-1,8 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2019/05/1.txt: -------------------------------------------------------------------------------- 1 | 3,9,7,9,10,9,4,9,99,-1,8 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2019/05/2.txt: -------------------------------------------------------------------------------- 1 | 3,3,1108,-1,8,3,4,3,99 2 | - 3 | 0 4 | -------------------------------------------------------------------------------- /tests/2019/05/3.txt: -------------------------------------------------------------------------------- 1 | 3,3,1107,-1,8,3,4,3,99 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2019/05/4.txt: -------------------------------------------------------------------------------- 1 | 3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2019/05/5.txt: -------------------------------------------------------------------------------- 1 | 3,3,1105,-1,9,1101,0,0,12,4,12,99,1 2 | - 3 | 1 4 | -------------------------------------------------------------------------------- /tests/2019/05/6.txt: -------------------------------------------------------------------------------- 1 | 3,21,1008,21,8,20,1005,20,22,107,8,21,20,1006,20,31, 2 | 1106,0,36,98,0,0,1002,21,125,20,4,20,1105,1,46,104, 3 | 999,1105,1,46,1101,1000,1,20,4,20,1105,1,46,98,99 4 | - 5 | 999 6 | -------------------------------------------------------------------------------- /tests/2019/06/0.txt: -------------------------------------------------------------------------------- 1 | COM)B 2 | B)C 3 | C)D 4 | D)E 5 | E)F 6 | B)G 7 | G)H 8 | D)I 9 | E)J 10 | J)K 11 | K)L 12 | 42 13 | - 14 | -------------------------------------------------------------------------------- /tests/2019/06/1.txt: -------------------------------------------------------------------------------- 1 | COM)B 2 | B)C 3 | C)D 4 | D)E 5 | E)F 6 | B)G 7 | G)H 8 | D)I 9 | E)J 10 | J)K 11 | K)L 12 | K)YOU 13 | I)SAN 14 | - 15 | 4 16 | -------------------------------------------------------------------------------- /tests/2019/07/0.txt: -------------------------------------------------------------------------------- 1 | 3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0 2 | 43210 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/07/1.txt: -------------------------------------------------------------------------------- 1 | 3,23,3,24,1002,24,10,24,1002,23,-1,23,101,5,23,23,1,24,23,23,4,23,99,0,0 2 | 54321 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/07/2.txt: -------------------------------------------------------------------------------- 1 | 3,31,3,32,1002,32,10,32,1001,31,-2,31,1007,31,0,33,1002,33,7,33,1,33,31,31,1,32,31,31,4,31,99,0,0,0 2 | 65210 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/07/3.txt: -------------------------------------------------------------------------------- 1 | 3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5 2 | - 3 | 139629729 4 | -------------------------------------------------------------------------------- /tests/2019/07/4.txt: -------------------------------------------------------------------------------- 1 | 3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,55,1005,55,26,1001,54,-5,54,1105,1,12,1,53,54,53,1008,54,0,55,1001,55,1,55,2,53,55,53,4,53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10 2 | - 3 | 18216 4 | -------------------------------------------------------------------------------- /tests/2019/08/0.txt: -------------------------------------------------------------------------------- 1 | 123456789012 2 | 1 # image_width=3,image_height=2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/08/1.txt: -------------------------------------------------------------------------------- 1 | 0222112222120000 2 | - # image_width=2,image_height=2 3 | ⟋ 4 | -------------------------------------------------------------------------------- /tests/2019/09/0.txt: -------------------------------------------------------------------------------- 1 | 109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99 2 | 109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99 # quine 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/09/1.txt: -------------------------------------------------------------------------------- 1 | 1102,34915192,34915192,7,4,7,99,0 2 | 1219070632396864 # 16-digit number 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/09/2.txt: -------------------------------------------------------------------------------- 1 | 104,1125899906842624,99 2 | 1125899906842624 # the large number in the middle 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/10/0.txt: -------------------------------------------------------------------------------- 1 | .#..# 2 | ..... 3 | ##### 4 | ....# 5 | ...## 6 | 8 7 | - 8 | -------------------------------------------------------------------------------- /tests/2019/10/1.txt: -------------------------------------------------------------------------------- 1 | ......#.#. 2 | #..#.#.... 3 | ..#######. 4 | .#.#.###.. 5 | .#..#..... 6 | ..#....#.# 7 | #..#....#. 8 | .##.#..### 9 | ##...#..#. 10 | .#....#### 11 | 33 12 | - 13 | -------------------------------------------------------------------------------- /tests/2019/10/2.txt: -------------------------------------------------------------------------------- 1 | #.#...#.#. 2 | .###....#. 3 | .#....#... 4 | ##.#.#.#.# 5 | ....#.#.#. 6 | .##..###.# 7 | ..#...##.. 8 | ..##....## 9 | ......#... 10 | .####.###. 11 | 35 12 | - 13 | -------------------------------------------------------------------------------- /tests/2019/10/3.txt: -------------------------------------------------------------------------------- 1 | .#..#..### 2 | ####.###.# 3 | ....###.#. 4 | ..###.##.# 5 | ##.##.#.#. 6 | ....###..# 7 | ..#.#..#.# 8 | #..#.#.### 9 | .##...##.# 10 | .....#.#.. 11 | 41 12 | - 13 | -------------------------------------------------------------------------------- /tests/2019/10/4.txt: -------------------------------------------------------------------------------- 1 | .#..##.###...####### 2 | ##.############..##. 3 | .#.######.########.# 4 | .###.#######.####.#. 5 | #####.##.#.##.###.## 6 | ..#####..#.######### 7 | #################### 8 | #.####....###.#.#.## 9 | ##.################# 10 | #####.##.###..####.. 11 | ..######..##.####### 12 | ####.##.####...##..# 13 | .#####..#.######.### 14 | ##...#.##########... 15 | #.##########.####### 16 | .####.#.###.###.#.## 17 | ....##.##.###..##### 18 | .#.#.###########.### 19 | #.#.#.#####.####.### 20 | ###.##.####.##.#..## 21 | 210 22 | 802 23 | -------------------------------------------------------------------------------- /tests/2019/12/0.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 179 # iterations=10 6 | 2772 7 | -------------------------------------------------------------------------------- /tests/2019/12/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1940 # iterations=100 6 | 4686774924 7 | -------------------------------------------------------------------------------- /tests/2019/14/0.txt: -------------------------------------------------------------------------------- 1 | 10 ORE => 10 A 2 | 1 ORE => 1 B 3 | 7 A, 1 B => 1 C 4 | 7 A, 1 C => 1 D 5 | 7 A, 1 D => 1 E 6 | 7 A, 1 E => 1 FUEL 7 | 31 8 | - 9 | -------------------------------------------------------------------------------- /tests/2019/14/1.txt: -------------------------------------------------------------------------------- 1 | 9 ORE => 2 A 2 | 8 ORE => 3 B 3 | 7 ORE => 5 C 4 | 3 A, 4 B => 1 AB 5 | 5 B, 7 C => 1 BC 6 | 4 C, 1 A => 1 CA 7 | 2 AB, 3 BC, 4 CA => 1 FUEL 8 | 165 9 | - 10 | -------------------------------------------------------------------------------- /tests/2019/14/2.txt: -------------------------------------------------------------------------------- 1 | 157 ORE => 5 NZVS 2 | 165 ORE => 6 DCFZ 3 | 44 XJWVT, 5 KHKGT, 1 QDVJ, 29 NZVS, 9 GPVTF, 48 HKGWZ => 1 FUEL 4 | 12 HKGWZ, 1 GPVTF, 8 PSHF => 9 QDVJ 5 | 179 ORE => 7 PSHF 6 | 177 ORE => 5 HKGWZ 7 | 7 DCFZ, 7 PSHF => 2 XJWVT 8 | 165 ORE => 2 GPVTF 9 | 3 DCFZ, 7 NZVS, 5 HKGWZ, 10 PSHF => 8 KHKGT 10 | 13312 11 | 82892753 12 | -------------------------------------------------------------------------------- /tests/2019/14/3.txt: -------------------------------------------------------------------------------- 1 | 2 VPVL, 7 FWMGM, 2 CXFTF, 11 MNCFX => 1 STKFG 2 | 17 NVRVD, 3 JNWZP => 8 VPVL 3 | 53 STKFG, 6 MNCFX, 46 VJHF, 81 HVMC, 68 CXFTF, 25 GNMV => 1 FUEL 4 | 22 VJHF, 37 MNCFX => 5 FWMGM 5 | 139 ORE => 4 NVRVD 6 | 144 ORE => 7 JNWZP 7 | 5 MNCFX, 7 RFSQX, 2 FWMGM, 2 VPVL, 19 CXFTF => 3 HVMC 8 | 5 VJHF, 7 MNCFX, 9 VPVL, 37 CXFTF => 6 GNMV 9 | 145 ORE => 6 MNCFX 10 | 1 NVRVD => 8 CXFTF 11 | 1 VJHF, 6 MNCFX => 4 RFSQX 12 | 176 ORE => 6 VJHF 13 | 180697 14 | 5586022 15 | -------------------------------------------------------------------------------- /tests/2019/14/4.txt: -------------------------------------------------------------------------------- 1 | 171 ORE => 8 CNZTR 2 | 7 ZLQW, 3 BMBT, 9 XCVML, 26 XMNCP, 1 WPTQ, 2 MZWV, 1 RJRHP => 4 PLWSL 3 | 114 ORE => 4 BHXH 4 | 14 VRPVC => 6 BMBT 5 | 6 BHXH, 18 KTJDG, 12 WPTQ, 7 PLWSL, 31 FHTLT, 37 ZDVW => 1 FUEL 6 | 6 WPTQ, 2 BMBT, 8 ZLQW, 18 KTJDG, 1 XMNCP, 6 MZWV, 1 RJRHP => 6 FHTLT 7 | 15 XDBXC, 2 LTCX, 1 VRPVC => 6 ZLQW 8 | 13 WPTQ, 10 LTCX, 3 RJRHP, 14 XMNCP, 2 MZWV, 1 ZLQW => 1 ZDVW 9 | 5 BMBT => 4 WPTQ 10 | 189 ORE => 9 KTJDG 11 | 1 MZWV, 17 XDBXC, 3 XCVML => 2 XMNCP 12 | 12 VRPVC, 27 CNZTR => 2 XDBXC 13 | 15 KTJDG, 12 BHXH => 5 XCVML 14 | 3 BHXH, 2 VRPVC => 7 MZWV 15 | 121 ORE => 7 VRPVC 16 | 7 XCVML => 6 RJRHP 17 | 5 BHXH, 4 VRPVC => 5 LTCX 18 | 2210736 19 | 460664 20 | -------------------------------------------------------------------------------- /tests/2019/16/0.txt: -------------------------------------------------------------------------------- 1 | 12345678 2 | 48226158 3 | - # iterations=1 4 | -------------------------------------------------------------------------------- /tests/2019/16/1.txt: -------------------------------------------------------------------------------- 1 | 12345678 2 | 34040438 3 | - # iterations=2 4 | -------------------------------------------------------------------------------- /tests/2019/16/2.txt: -------------------------------------------------------------------------------- 1 | 12345678 2 | 03415518 3 | - # iterations=3 4 | -------------------------------------------------------------------------------- /tests/2019/16/3.txt: -------------------------------------------------------------------------------- 1 | 12345678 2 | 01029498 3 | - # iterations=4 4 | -------------------------------------------------------------------------------- /tests/2019/16/4.txt: -------------------------------------------------------------------------------- 1 | 80871224585914546619083218645595 2 | 24176176 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/16/5.txt: -------------------------------------------------------------------------------- 1 | 19617804207202209144916044189917 2 | 73745418 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/16/6.txt: -------------------------------------------------------------------------------- 1 | 69317163492948606335995924319873 2 | 52432133 3 | - 4 | -------------------------------------------------------------------------------- /tests/2019/16/7.txt: -------------------------------------------------------------------------------- 1 | 03036732577212944063491565474664 2 | - 3 | 84462026 4 | -------------------------------------------------------------------------------- /tests/2019/16/8.txt: -------------------------------------------------------------------------------- 1 | 02935109699940807407585447034323 2 | - 3 | 78725270 4 | -------------------------------------------------------------------------------- /tests/2019/16/9.txt: -------------------------------------------------------------------------------- 1 | 03081770884921959731165446850517 2 | - 3 | 53553731 4 | -------------------------------------------------------------------------------- /tests/2019/18/0.txt: -------------------------------------------------------------------------------- 1 | ######### 2 | #b.A.@.a# 3 | ######### 4 | 8 5 | - 6 | -------------------------------------------------------------------------------- /tests/2019/18/1.txt: -------------------------------------------------------------------------------- 1 | ######################## 2 | #f.D.E.e.C.b.A.@.a.B.c.# 3 | ######################.# 4 | #d.....................# 5 | ######################## 6 | 86 7 | - 8 | -------------------------------------------------------------------------------- /tests/2019/18/2.txt: -------------------------------------------------------------------------------- 1 | ######################## 2 | #...............b.C.D.f# 3 | #.###################### 4 | #.....@.a.B.c.d.A.e.F.g# 5 | ######################## 6 | 132 7 | - 8 | -------------------------------------------------------------------------------- /tests/2019/18/3.txt: -------------------------------------------------------------------------------- 1 | ################# 2 | #i.G..c...e..H.p# 3 | ########.######## 4 | #j.A..b...f..D.o# 5 | ########@######## 6 | #k.E..a...g..B.n# 7 | ########.######## 8 | #l.F..d...h..C.m# 9 | ################# 10 | 136 11 | - 12 | -------------------------------------------------------------------------------- /tests/2019/18/4.txt: -------------------------------------------------------------------------------- 1 | ######################## 2 | #@..............ac.GI.b# 3 | ###d#e#f################ 4 | ###A#B#C################ 5 | ###g#h#i################ 6 | ######################## 7 | 81 8 | - 9 | -------------------------------------------------------------------------------- /tests/2019/18/5.txt: -------------------------------------------------------------------------------- 1 | ####### 2 | #a.#Cd# 3 | ##...## 4 | ##.@.## 5 | ##...## 6 | #cB#Ab# 7 | ####### 8 | - 9 | 8 10 | -------------------------------------------------------------------------------- /tests/2019/18/6.txt: -------------------------------------------------------------------------------- 1 | ############### 2 | #d.ABC.#.....a# 3 | ######@#@###### 4 | ############### 5 | ######@#@###### 6 | #b.....#.....c# 7 | ############### 8 | - 9 | 24 10 | -------------------------------------------------------------------------------- /tests/2019/18/7.txt: -------------------------------------------------------------------------------- 1 | ############# 2 | #DcBa.#.GhKl# 3 | #.###@#@#I### 4 | #e#d#####j#k# 5 | ###C#@#@###J# 6 | #fEbA.#.FgHi# 7 | ############# 8 | - 9 | 32 10 | -------------------------------------------------------------------------------- /tests/2019/18/8.txt: -------------------------------------------------------------------------------- 1 | ############# 2 | #g#f.D#..h#l# 3 | #F###e#E###.# 4 | #dCba@#@BcIJ# 5 | ############# 6 | #nK.L@#@G...# 7 | #M###N#H###.# 8 | #o#m..#i#jk.# 9 | ############# 10 | - 11 | 72 12 | -------------------------------------------------------------------------------- /tests/2019/18/fizbin.txt: -------------------------------------------------------------------------------- 1 | ################### 2 | #.c.B...a...@..Ab.# 3 | #.########.######.# 4 | #.................# 5 | ################### 6 | 26 7 | - 8 | # https://www.reddit.com/r/adventofcode/comments/ejbm8r/2019_day_18_are_we_allowed_to_assume_no_cycles_in/ 9 | -------------------------------------------------------------------------------- /tests/2019/18/swilkoBaggins.broken.txt: -------------------------------------------------------------------------------- 1 | ########## 2 | #.a###.Ab# 3 | #.B..@.### 4 | #...###### 5 | ########## 6 | 20 7 | - 8 | # https://www.reddit.com/r/adventofcode/comments/ecj4e7/2019_day_18_challenging_input/ 9 | -------------------------------------------------------------------------------- /tests/2019/20/0.txt: -------------------------------------------------------------------------------- 1 | A 2 | A 3 | #######.######### 4 | #######.........# 5 | #######.#######.# 6 | #######.#######.# 7 | #######.#######.# 8 | ##### B ###.# 9 | BC...## C ###.# 10 | ##.## ###.# 11 | ##...DE F ###.# 12 | ##### G ###.# 13 | #########.#####.# 14 | DE..#######...###.# 15 | #.#########.###.# 16 | FG..#########.....# 17 | ###########.##### 18 | Z 19 | Z 20 | 23 21 | 26 22 | -------------------------------------------------------------------------------- /tests/2019/24/0.txt: -------------------------------------------------------------------------------- 1 | ....# 2 | #..#. 3 | #..## 4 | ..#.. 5 | #.... 6 | 2129920 7 | 99 # iterations=10 8 | -------------------------------------------------------------------------------- /tests/2019/test_02_1202_program_alarm.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from aoc_wim.aoc2019 import IntComputer 4 | 5 | 6 | @pytest.mark.parametrize("data,output", [ 7 | ("1,9,10,3,2,3,11,0,99,30,40,50", "3500,9,10,70,2,3,11,0,99,30,40,50"), 8 | ("1,0,0,0,99", "2,0,0,0,99"), 9 | ("2,3,0,3,99", "2,3,0,6,99"), 10 | ("2,4,4,5,99,0", "2,4,4,5,99,9801"), 11 | ("1,1,1,4,99,5,6,0,99", "30,1,1,4,2,5,6,0,99"), 12 | ]) 13 | def test_intcode_samples(data, output): 14 | comp = IntComputer(data) 15 | comp.run() 16 | assert ",".join([str(v) for v in comp.reg.values()]) == output 17 | -------------------------------------------------------------------------------- /tests/2020/01/0.txt: -------------------------------------------------------------------------------- 1 | 1721 2 | 979 3 | 366 4 | 299 5 | 675 6 | 1456 7 | 514579 # 1721 * 299 8 | 241861950 # 979 * 366 * 675 9 | -------------------------------------------------------------------------------- /tests/2020/02/0.txt: -------------------------------------------------------------------------------- 1 | 1-3 a: abcde 2 | 1-3 b: cdefg 3 | 2-9 c: ccccccccc 4 | 2 5 | 1 6 | -------------------------------------------------------------------------------- /tests/2020/03/0.txt: -------------------------------------------------------------------------------- 1 | ..##....... 2 | #...#...#.. 3 | .#....#..#. 4 | ..#.#...#.# 5 | .#...##..#. 6 | ..#.##..... 7 | .#.#.#....# 8 | .#........# 9 | #.##...#... 10 | #...##....# 11 | .#..#...#.# 12 | 7 13 | 336 14 | -------------------------------------------------------------------------------- /tests/2020/04/0.txt: -------------------------------------------------------------------------------- 1 | ecl:gry pid:860033327 eyr:2020 hcl:#fffffd 2 | byr:1937 iyr:2017 cid:147 hgt:183cm 3 | 4 | iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 5 | hcl:#cfa07d byr:1929 6 | 7 | hcl:#ae17e1 iyr:2013 8 | eyr:2024 9 | ecl:brn pid:760753108 byr:1931 10 | hgt:179cm 11 | 12 | hcl:#cfa07d eyr:2025 pid:166559648 13 | iyr:2011 ecl:brn hgt:59in 14 | 2 15 | - 16 | -------------------------------------------------------------------------------- /tests/2020/04/1.txt: -------------------------------------------------------------------------------- 1 | eyr:1972 cid:100 2 | hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926 3 | 4 | iyr:2019 5 | hcl:#602927 eyr:1967 hgt:170cm 6 | ecl:grn pid:012533040 byr:1946 7 | 8 | hcl:dab227 iyr:2012 9 | ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277 10 | 11 | hgt:59cm ecl:zzz 12 | eyr:2038 hcl:74454a iyr:2023 13 | pid:3556412378 byr:2007 14 | - 15 | 0 16 | -------------------------------------------------------------------------------- /tests/2020/04/2.txt: -------------------------------------------------------------------------------- 1 | pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980 2 | hcl:#623a2f 3 | 4 | eyr:2029 ecl:blu cid:129 byr:1989 5 | iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm 6 | 7 | hcl:#888785 8 | hgt:164cm byr:2001 iyr:2015 cid:88 9 | pid:545766238 ecl:hzl 10 | eyr:2022 11 | 12 | iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719 13 | - 14 | 4 15 | -------------------------------------------------------------------------------- /tests/2020/05/0.txt: -------------------------------------------------------------------------------- 1 | FBFBBFFRLR 2 | 357 3 | - 4 | -------------------------------------------------------------------------------- /tests/2020/05/1.txt: -------------------------------------------------------------------------------- 1 | BFFFBBFRRR 2 | 567 3 | - 4 | -------------------------------------------------------------------------------- /tests/2020/05/2.txt: -------------------------------------------------------------------------------- 1 | FFFBBBFRRR 2 | 119 3 | - 4 | -------------------------------------------------------------------------------- /tests/2020/05/3.txt: -------------------------------------------------------------------------------- 1 | BBFFBBFRLL 2 | 820 3 | - 4 | -------------------------------------------------------------------------------- /tests/2020/06/0.txt: -------------------------------------------------------------------------------- 1 | abcx 2 | abcy 3 | abcz 4 | 6 5 | 3 6 | -------------------------------------------------------------------------------- /tests/2020/06/1.txt: -------------------------------------------------------------------------------- 1 | abc 2 | 3 | a 4 | b 5 | c 6 | 7 | ab 8 | ac 9 | 10 | a 11 | a 12 | a 13 | a 14 | 15 | b 16 | 11 17 | 6 18 | -------------------------------------------------------------------------------- /tests/2020/07/0.txt: -------------------------------------------------------------------------------- 1 | light red bags contain 1 bright white bag, 2 muted yellow bags. 2 | dark orange bags contain 3 bright white bags, 4 muted yellow bags. 3 | bright white bags contain 1 shiny gold bag. 4 | muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. 5 | shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. 6 | dark olive bags contain 3 faded blue bags, 4 dotted black bags. 7 | vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. 8 | faded blue bags contain no other bags. 9 | dotted black bags contain no other bags. 10 | 4 11 | 32 12 | -------------------------------------------------------------------------------- /tests/2020/07/1.txt: -------------------------------------------------------------------------------- 1 | shiny gold bags contain 2 dark red bags. 2 | dark red bags contain 2 dark orange bags. 3 | dark orange bags contain 2 dark yellow bags. 4 | dark yellow bags contain 2 dark green bags. 5 | dark green bags contain 2 dark blue bags. 6 | dark blue bags contain 2 dark violet bags. 7 | dark violet bags contain no other bags. 8 | - 9 | 126 10 | -------------------------------------------------------------------------------- /tests/2020/08/0.txt: -------------------------------------------------------------------------------- 1 | nop +0 2 | acc +1 3 | jmp +4 4 | acc +3 5 | jmp -3 6 | acc -99 7 | acc +1 8 | jmp -4 9 | acc +6 10 | 5 11 | 8 12 | -------------------------------------------------------------------------------- /tests/2020/09/0.txt: -------------------------------------------------------------------------------- 1 | 35 2 | 20 3 | 15 4 | 25 5 | 47 6 | 40 7 | 62 8 | 55 9 | 65 10 | 95 11 | 102 12 | 117 13 | 150 14 | 182 15 | 127 16 | 219 17 | 299 18 | 277 19 | 309 20 | 576 21 | 127 22 | 62 23 | -------------------------------------------------------------------------------- /tests/2020/09/jwolf.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 40 7 | 8 8 | 12 9 | 20 10 | 40 11 | 28 # not 80 because that would be the chunk with only 1 number, the target itself 12 | -------------------------------------------------------------------------------- /tests/2020/10/0.txt: -------------------------------------------------------------------------------- 1 | 16 2 | 10 3 | 15 4 | 5 5 | 1 6 | 11 7 | 7 8 | 19 9 | 6 10 | 12 11 | 4 12 | 35 # 7 * 5 13 | 8 14 | -------------------------------------------------------------------------------- /tests/2020/10/1.txt: -------------------------------------------------------------------------------- 1 | 28 2 | 33 3 | 18 4 | 42 5 | 31 6 | 14 7 | 46 8 | 20 9 | 48 10 | 47 11 | 24 12 | 23 13 | 49 14 | 45 15 | 19 16 | 38 17 | 39 18 | 11 19 | 1 20 | 32 21 | 25 22 | 35 23 | 8 24 | 17 25 | 7 26 | 9 27 | 4 28 | 2 29 | 34 30 | 10 31 | 3 32 | 220 # 22 * 10 33 | 19208 34 | -------------------------------------------------------------------------------- /tests/2020/11/0.txt: -------------------------------------------------------------------------------- 1 | L.LL.LL.LL 2 | LLLLLLL.LL 3 | L.L.L..L.. 4 | LLLL.LL.LL 5 | L.LL.LL.LL 6 | L.LLLLL.LL 7 | ..L.L..... 8 | LLLLLLLLLL 9 | L.LLLLLL.L 10 | L.LLLLL.LL 11 | 37 12 | 26 13 | -------------------------------------------------------------------------------- /tests/2020/12/0.txt: -------------------------------------------------------------------------------- 1 | F10 2 | N3 3 | F7 4 | R90 5 | F11 6 | 25 7 | 286 8 | -------------------------------------------------------------------------------- /tests/2020/13/0.txt: -------------------------------------------------------------------------------- 1 | 939 2 | 7,13,x,x,59,x,31,19 3 | 295 4 | 1068781 5 | -------------------------------------------------------------------------------- /tests/2020/13/1.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 17,x,13,19 3 | - 4 | 3417 5 | -------------------------------------------------------------------------------- /tests/2020/13/2.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 67,7,59,61 3 | - 4 | 754018 5 | -------------------------------------------------------------------------------- /tests/2020/13/3.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 67,x,7,59,61 3 | - 4 | 779210 5 | -------------------------------------------------------------------------------- /tests/2020/13/4.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 67,7,x,59,61 3 | - 4 | 1261476 5 | -------------------------------------------------------------------------------- /tests/2020/13/5.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1789,37,47,1889 3 | - 4 | 1202161486 5 | -------------------------------------------------------------------------------- /tests/2020/14/0.txt: -------------------------------------------------------------------------------- 1 | mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X 2 | mem[8] = 11 3 | mem[7] = 101 4 | mem[8] = 0 5 | 165 6 | - 7 | -------------------------------------------------------------------------------- /tests/2020/14/1.txt: -------------------------------------------------------------------------------- 1 | mask = 000000000000000000000000000000X1001X 2 | mem[42] = 100 3 | mask = 00000000000000000000000000000000X0XX 4 | mem[26] = 1 5 | - 6 | 208 7 | -------------------------------------------------------------------------------- /tests/2020/15/0.slow.txt: -------------------------------------------------------------------------------- 1 | 0,3,6 2 | 436 3 | 175594 4 | -------------------------------------------------------------------------------- /tests/2020/15/1.slow.txt: -------------------------------------------------------------------------------- 1 | 1,3,2 2 | 1 3 | 2578 4 | -------------------------------------------------------------------------------- /tests/2020/15/2.slow.txt: -------------------------------------------------------------------------------- 1 | 2,1,3 2 | 10 3 | 3544142 4 | -------------------------------------------------------------------------------- /tests/2020/15/3.slow.txt: -------------------------------------------------------------------------------- 1 | 1,2,3 2 | 27 3 | 261214 4 | -------------------------------------------------------------------------------- /tests/2020/15/4.slow.txt: -------------------------------------------------------------------------------- 1 | 2,3,1 2 | 78 3 | 6895259 4 | -------------------------------------------------------------------------------- /tests/2020/15/5.slow.txt: -------------------------------------------------------------------------------- 1 | 3,2,1 2 | 438 3 | 18 4 | -------------------------------------------------------------------------------- /tests/2020/15/6.slow.txt: -------------------------------------------------------------------------------- 1 | 3,1,2 2 | 1836 3 | 362 4 | -------------------------------------------------------------------------------- /tests/2020/16/0.txt: -------------------------------------------------------------------------------- 1 | class: 1-3 or 5-7 2 | row: 6-11 or 33-44 3 | seat: 13-40 or 45-50 4 | 5 | your ticket: 6 | 7,1,14 7 | 8 | nearby tickets: 9 | 7,3,47 10 | 40,4,50 11 | 55,2,20 12 | 38,6,12 13 | 71 14 | - 15 | -------------------------------------------------------------------------------- /tests/2020/16/1.txt: -------------------------------------------------------------------------------- 1 | class: 0-1 or 4-19 2 | row: 0-5 or 8-19 3 | seat: 0-13 or 16-19 4 | 5 | your ticket: 6 | 11,12,13 7 | 8 | nearby tickets: 9 | 3,9,18 10 | 15,1,5 11 | 5,14,9 12 | - 13 | - 14 | -------------------------------------------------------------------------------- /tests/2020/17/0.txt: -------------------------------------------------------------------------------- 1 | .#. 2 | ..# 3 | ### 4 | 112 5 | 848 6 | -------------------------------------------------------------------------------- /tests/2020/18/0.txt: -------------------------------------------------------------------------------- 1 | 1 + 2 * 3 + 4 * 5 + 6 2 | 71 3 | 231 4 | -------------------------------------------------------------------------------- /tests/2020/18/1.txt: -------------------------------------------------------------------------------- 1 | 1 + (2 * 3) + (4 * (5 + 6)) 2 | 51 3 | 51 4 | -------------------------------------------------------------------------------- /tests/2020/18/2.txt: -------------------------------------------------------------------------------- 1 | 2 * 3 + (4 * 5) 2 | 26 3 | 46 4 | -------------------------------------------------------------------------------- /tests/2020/18/3.txt: -------------------------------------------------------------------------------- 1 | 5 + (8 * 3 + 9 + 3 * 4 * 3) 2 | 437 3 | 1445 4 | -------------------------------------------------------------------------------- /tests/2020/18/4.txt: -------------------------------------------------------------------------------- 1 | 5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4)) 2 | 12240 3 | 669060 4 | -------------------------------------------------------------------------------- /tests/2020/18/5.txt: -------------------------------------------------------------------------------- 1 | ((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2 2 | 13632 3 | 23340 4 | -------------------------------------------------------------------------------- /tests/2020/19/0.txt: -------------------------------------------------------------------------------- 1 | 0: 1 2 2 | 1: "a" 3 | 2: 1 3 | 3 1 4 | 3: "b" 5 | 6 | aab 7 | aba 8 | 2 9 | - 10 | -------------------------------------------------------------------------------- /tests/2020/19/1.txt: -------------------------------------------------------------------------------- 1 | 0: 4 1 5 2 | 1: 2 3 | 3 2 3 | 2: 4 4 | 5 5 4 | 3: 4 5 | 5 4 5 | 4: "a" 6 | 5: "b" 7 | 8 | ababbb 9 | bababa 10 | abbbab 11 | aaabbb 12 | aaaabbb 13 | 2 14 | - 15 | -------------------------------------------------------------------------------- /tests/2020/19/jonathanpaulson.broken.txt: -------------------------------------------------------------------------------- 1 | 0: 1 1 2 | 1: 2 | 1 1 3 | 2: "a" 4 | 5 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab 6 | 0 7 | - 8 | # Jonathan Paulson case, blows up the simple recursive approach 9 | # https://www.reddit.com/r/adventofcode/comments/kg1mro/2020_day_19_solutions/gky23wf 10 | -------------------------------------------------------------------------------- /tests/2020/21/0.txt: -------------------------------------------------------------------------------- 1 | mxmxvkd kfcds sqjhc nhms (contains dairy, fish) 2 | trh fvjkl sbzzf mxmxvkd (contains dairy) 3 | sqjhc fvjkl (contains soy) 4 | sqjhc mxmxvkd sbzzf (contains fish) 5 | 5 6 | mxmxvkd,sqjhc,fvjkl 7 | -------------------------------------------------------------------------------- /tests/2020/22/0.txt: -------------------------------------------------------------------------------- 1 | Player 1: 2 | 9 3 | 2 4 | 6 5 | 3 6 | 1 7 | 8 | Player 2: 9 | 5 10 | 8 11 | 4 12 | 7 13 | 10 14 | 306 15 | 291 16 | -------------------------------------------------------------------------------- /tests/2020/23/0.slow.txt: -------------------------------------------------------------------------------- 1 | 389125467 2 | 67384529 3 | 149245887792 4 | -------------------------------------------------------------------------------- /tests/2020/25/0.txt: -------------------------------------------------------------------------------- 1 | 5764801 2 | 17807724 3 | 14897079 4 | - 5 | -------------------------------------------------------------------------------- /tests/2020/test_16_ticket_translation.py: -------------------------------------------------------------------------------- 1 | from aoc_wim.aoc2020 import q16 2 | 3 | part_b_test_data = """\ 4 | class: 0-1 or 4-19 5 | row: 0-5 or 8-19 6 | seat: 0-13 or 16-19 7 | 8 | your ticket: 9 | 11,12,13 10 | 11 | nearby tickets: 12 | 3,9,18 13 | 15,1,5 14 | 5,14,9 15 | """ 16 | 17 | 18 | def test_identify_fields(): 19 | fields, my_ticket, nearby_tickets = q16.parsed(part_b_test_data) 20 | valid_tickets = q16.get_valid_tickets(fields, nearby_tickets) 21 | known = q16.identify_fields(fields, valid_tickets) 22 | my_ticket_dict = q16.translate_my_ticket(known, my_ticket) 23 | assert my_ticket_dict == { 24 | "class": 12, 25 | "row": 11, 26 | "seat": 13, 27 | } 28 | -------------------------------------------------------------------------------- /tests/2020/test_22_crab_combat.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | from aoc_wim.aoc2020 import q22 4 | 5 | # Here is an example of a small game that would loop forever without the 6 | # infinite game prevention rule: 7 | 8 | test_data = """\ 9 | Player 1: 10 | 43 11 | 19 12 | 13 | Player 2: 14 | 2 15 | 29 16 | 14 17 | """ 18 | 19 | 20 | def test_infinite_recursion_rule(): 21 | data1, data2 = test_data.split("\n\n") 22 | cards1 = [int(x) for x in data1.splitlines()[1:]] 23 | cards2 = [int(x) for x in data2.splitlines()[1:]] 24 | p1a = deque(cards1) 25 | p2a = deque(cards2) 26 | winner = q22.play(p1a, p2a, part="b") 27 | assert winner == 1 28 | -------------------------------------------------------------------------------- /tests/2021/01/0.txt: -------------------------------------------------------------------------------- 1 | 199 2 | 200 3 | 208 4 | 210 5 | 200 6 | 207 7 | 240 8 | 269 9 | 260 10 | 263 11 | 7 12 | 5 13 | -------------------------------------------------------------------------------- /tests/2021/02/0.txt: -------------------------------------------------------------------------------- 1 | forward 5 2 | down 5 3 | forward 8 4 | up 3 5 | down 8 6 | forward 2 7 | 150 8 | 900 9 | -------------------------------------------------------------------------------- /tests/2021/03/0.txt: -------------------------------------------------------------------------------- 1 | 00100 2 | 11110 3 | 10110 4 | 10111 5 | 10101 6 | 01111 7 | 00111 8 | 11100 9 | 10000 10 | 11001 11 | 00010 12 | 01010 13 | 198 14 | 230 15 | -------------------------------------------------------------------------------- /tests/2021/04/0.txt: -------------------------------------------------------------------------------- 1 | 7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 2 | 3 | 22 13 17 11 0 4 | 8 2 23 4 24 5 | 21 9 14 16 7 6 | 6 10 3 18 5 7 | 1 12 20 15 19 8 | 9 | 3 15 0 2 22 10 | 9 18 13 17 5 11 | 19 8 7 25 23 12 | 20 11 10 24 4 13 | 14 21 16 12 6 14 | 15 | 14 21 17 24 4 16 | 10 16 15 9 19 17 | 18 8 23 26 20 18 | 22 11 13 6 5 19 | 2 0 12 3 7 20 | 4512 21 | 1924 22 | -------------------------------------------------------------------------------- /tests/2021/05/0.txt: -------------------------------------------------------------------------------- 1 | 0,9 -> 5,9 2 | 8,0 -> 0,8 3 | 9,4 -> 3,4 4 | 2,2 -> 2,1 5 | 7,0 -> 7,4 6 | 6,4 -> 2,0 7 | 0,9 -> 2,9 8 | 3,4 -> 1,4 9 | 0,0 -> 8,8 10 | 5,5 -> 8,2 11 | 5 12 | 12 13 | -------------------------------------------------------------------------------- /tests/2021/06/0.txt: -------------------------------------------------------------------------------- 1 | 3,4,3,1,2 2 | 5934 3 | 26984457539 4 | -------------------------------------------------------------------------------- /tests/2021/07/0.txt: -------------------------------------------------------------------------------- 1 | 16,1,2,0,4,2,7,1,2,14 2 | 37 3 | 168 4 | -------------------------------------------------------------------------------- /tests/2021/08/0.txt: -------------------------------------------------------------------------------- 1 | acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab | 2 | cdfeb fcadb cdfeb cdbaf 3 | 0 4 | 5353 5 | -------------------------------------------------------------------------------- /tests/2021/09/0.txt: -------------------------------------------------------------------------------- 1 | 2199943210 2 | 3987894921 3 | 9856789892 4 | 8767896789 5 | 9899965678 6 | 15 7 | 1134 8 | -------------------------------------------------------------------------------- /tests/2021/10/0.txt: -------------------------------------------------------------------------------- 1 | [({(<(())[]>[[{[]{<()<>> 2 | [(()[<>])]({[<{<<[]>>( 3 | {([(<{}[<>[]}>{[]{[(<()> 4 | (((({<>}<{<{<>}{[]{[]{} 5 | [[<[([]))<([[{}[[()]]] 6 | [{[{({}]{}}([{[{{{}}([] 7 | {<[[]]>}<{[{[{[]{()[[[] 8 | [<(<(<(<{}))><([]([]() 9 | <{([([[(<>()){}]>(<<{{ 10 | <{([{{}}[<[[[<>{}]]]>[]] 11 | 26397 12 | 288957 13 | -------------------------------------------------------------------------------- /tests/2021/11/0.txt: -------------------------------------------------------------------------------- 1 | 5483143223 2 | 2745854711 3 | 5264556173 4 | 6141336146 5 | 6357385478 6 | 4167524645 7 | 2176841721 8 | 6882881134 9 | 4846848554 10 | 5283751526 11 | 1656 12 | 195 13 | -------------------------------------------------------------------------------- /tests/2021/12/0.txt: -------------------------------------------------------------------------------- 1 | start-A 2 | start-b 3 | A-c 4 | A-b 5 | b-d 6 | A-end 7 | b-end 8 | 10 9 | 36 10 | -------------------------------------------------------------------------------- /tests/2021/12/1.txt: -------------------------------------------------------------------------------- 1 | dc-end 2 | HN-start 3 | start-kj 4 | dc-start 5 | dc-HN 6 | LN-dc 7 | HN-end 8 | kj-sa 9 | kj-HN 10 | kj-dc 11 | 19 12 | 103 13 | -------------------------------------------------------------------------------- /tests/2021/12/2.txt: -------------------------------------------------------------------------------- 1 | fs-end 2 | he-DX 3 | fs-he 4 | start-DX 5 | pj-DX 6 | end-zg 7 | zg-sl 8 | zg-pj 9 | pj-he 10 | RW-he 11 | fs-DX 12 | pj-RW 13 | zg-RW 14 | start-pj 15 | he-WI 16 | zg-he 17 | pj-fs 18 | start-RW 19 | 226 20 | 3509 21 | -------------------------------------------------------------------------------- /tests/2021/13/0.txt: -------------------------------------------------------------------------------- 1 | 6,10 2 | 0,14 3 | 9,10 4 | 0,3 5 | 10,4 6 | 4,11 7 | 6,0 8 | 6,12 9 | 4,1 10 | 0,13 11 | 10,12 12 | 3,4 13 | 3,0 14 | 8,4 15 | 1,10 16 | 2,14 17 | 8,10 18 | 9,0 19 | 20 | fold along y=7 21 | fold along x=5 22 | 17 23 | □ 24 | -------------------------------------------------------------------------------- /tests/2021/14/0.txt: -------------------------------------------------------------------------------- 1 | NNCB 2 | 3 | CH -> B 4 | HH -> N 5 | CB -> H 6 | NH -> C 7 | HB -> C 8 | HC -> B 9 | HN -> C 10 | NN -> C 11 | BH -> H 12 | NC -> B 13 | NB -> B 14 | BN -> B 15 | BB -> N 16 | BC -> B 17 | CC -> N 18 | CN -> C 19 | 1588 20 | 2188189693529 21 | -------------------------------------------------------------------------------- /tests/2021/15/0.txt: -------------------------------------------------------------------------------- 1 | 1163751742 2 | 1381373672 3 | 2136511328 4 | 3694931569 5 | 7463417111 6 | 1319128137 7 | 1359912421 8 | 3125421639 9 | 1293138521 10 | 2311944581 11 | 40 12 | 315 13 | -------------------------------------------------------------------------------- /tests/2021/16/0.txt: -------------------------------------------------------------------------------- 1 | D2FE28 2 | 6 3 | - 4 | -------------------------------------------------------------------------------- /tests/2021/16/1.txt: -------------------------------------------------------------------------------- 1 | 38006F45291200 2 | 9 # 1 + 6 + 2 3 | - 4 | -------------------------------------------------------------------------------- /tests/2021/16/10.txt: -------------------------------------------------------------------------------- 1 | CE00C43D881120 2 | - 3 | 9 # finds the maximum of 7, 8, and 9, resulting in the value 9. 4 | -------------------------------------------------------------------------------- /tests/2021/16/11.txt: -------------------------------------------------------------------------------- 1 | D8005AC2A8F0 2 | - 3 | 1 # produces 1, because 5 is less than 15. 4 | -------------------------------------------------------------------------------- /tests/2021/16/12.txt: -------------------------------------------------------------------------------- 1 | F600BC2D8F 2 | - 3 | 0 # produces 0, because 5 is not greater than 15. 4 | -------------------------------------------------------------------------------- /tests/2021/16/13.txt: -------------------------------------------------------------------------------- 1 | 9C005AC2F8F0 2 | - 3 | 0 # produces 0, because 5 is not equal to 15. 4 | -------------------------------------------------------------------------------- /tests/2021/16/14.txt: -------------------------------------------------------------------------------- 1 | 9C0141080250320F1802104A08 2 | - 3 | 1 # produces 1, because 1 + 3 = 2 * 2. 4 | -------------------------------------------------------------------------------- /tests/2021/16/2.txt: -------------------------------------------------------------------------------- 1 | EE00D40C823060 2 | 14 # 7 + 2 + 4 + 1 3 | - 4 | -------------------------------------------------------------------------------- /tests/2021/16/3.txt: -------------------------------------------------------------------------------- 1 | 8A004A801A8002F478 2 | 16 3 | - 4 | -------------------------------------------------------------------------------- /tests/2021/16/4.txt: -------------------------------------------------------------------------------- 1 | 620080001611562C8802118E34 2 | 12 3 | - 4 | -------------------------------------------------------------------------------- /tests/2021/16/5.txt: -------------------------------------------------------------------------------- 1 | C0015000016115A2E0802F182340 2 | 23 3 | - 4 | -------------------------------------------------------------------------------- /tests/2021/16/6.txt: -------------------------------------------------------------------------------- 1 | A0016C880162017C3686B18A3D4780 2 | 31 3 | - 4 | -------------------------------------------------------------------------------- /tests/2021/16/7.txt: -------------------------------------------------------------------------------- 1 | C200B40A82 2 | - 3 | 3 # finds the sum of 1 and 2, resulting in the value 3. 4 | -------------------------------------------------------------------------------- /tests/2021/16/8.txt: -------------------------------------------------------------------------------- 1 | 04005AC33890 2 | - 3 | 54 # finds the product of 6 and 9, resulting in the value 54. 4 | -------------------------------------------------------------------------------- /tests/2021/16/9.txt: -------------------------------------------------------------------------------- 1 | 880086C3E88112 2 | - 3 | 7 # finds the minimum of 7, 8, and 9, resulting in the value 7. 4 | -------------------------------------------------------------------------------- /tests/2021/17/0.txt: -------------------------------------------------------------------------------- 1 | target area: x=20..30, y=-10..-5 2 | 45 3 | 112 4 | -------------------------------------------------------------------------------- /tests/2021/18/0.txt: -------------------------------------------------------------------------------- 1 | [[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]] 2 | [[[5,[2,8]],4],[5,[[9,9],0]]] 3 | [6,[[[6,2],[5,6]],[[7,6],[4,7]]]] 4 | [[[6,[0,7]],[0,9]],[4,[9,[9,0]]]] 5 | [[[7,[6,4]],[3,[1,3]]],[[[5,5],1],9]] 6 | [[6,[[7,3],[3,2]]],[[[3,8],[5,7]],4]] 7 | [[[[5,4],[7,7]],8],[[8,3],8]] 8 | [[9,3],[[9,9],[6,[4,9]]]] 9 | [[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]] 10 | [[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]] 11 | 4140 12 | 3993 13 | -------------------------------------------------------------------------------- /tests/2021/20/0.txt: -------------------------------------------------------------------------------- 1 | ..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..## 2 | #..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.### 3 | .######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#. 4 | .#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#..... 5 | .#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.. 6 | ...####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#..... 7 | ..##..####..#...#.#.#...##..#.#..###..#####........#..####......#..# 8 | 9 | #..#. 10 | #.... 11 | ##..# 12 | ..#.. 13 | ..### 14 | 35 15 | 3351 16 | -------------------------------------------------------------------------------- /tests/2021/21/0.txt: -------------------------------------------------------------------------------- 1 | Player 1 starting position: 4 2 | Player 2 starting position: 8 3 | 739785 4 | 444356092776315 5 | -------------------------------------------------------------------------------- /tests/2021/22/0.txt: -------------------------------------------------------------------------------- 1 | on x=10..12,y=10..12,z=10..12 2 | on x=11..13,y=11..13,z=11..13 3 | off x=9..11,y=9..11,z=9..11 4 | on x=10..10,y=10..10,z=10..10 5 | 39 6 | - 7 | -------------------------------------------------------------------------------- /tests/2021/23/0.slow.txt: -------------------------------------------------------------------------------- 1 | ############# 2 | #...........# 3 | ###B#C#B#D### 4 | #A#D#C#A# 5 | ######### 6 | 12521 7 | 44169 8 | -------------------------------------------------------------------------------- /tests/2021/25/0.txt: -------------------------------------------------------------------------------- 1 | v...>>.vv> 2 | .vv>>.vv.. 3 | >>.>v>...v 4 | >>v>>.>.v. 5 | v>v.vv.v.. 6 | >.>>..v... 7 | .vv..>.>v. 8 | v.v..>>v.v 9 | ....v..v.> 10 | 58 11 | - 12 | -------------------------------------------------------------------------------- /tests/2022/01/0.txt: -------------------------------------------------------------------------------- 1 | 1000 2 | 2000 3 | 3000 4 | 5 | 4000 6 | 7 | 5000 8 | 6000 9 | 10 | 7000 11 | 8000 12 | 9000 13 | 14 | 10000 15 | 24000 16 | 45000 17 | -------------------------------------------------------------------------------- /tests/2022/02/0.txt: -------------------------------------------------------------------------------- 1 | A Y 2 | B X 3 | C Z 4 | 15 5 | 12 6 | -------------------------------------------------------------------------------- /tests/2022/03/0.txt: -------------------------------------------------------------------------------- 1 | vJrwpWtwJgWrhcsFMMfFFhFp 2 | jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL 3 | PmmdzqPrVvPwwTWBwg 4 | wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn 5 | ttgJtRGJQctTZtZT 6 | CrZsJsPPZsGzwwsLwLmpwMDw 7 | 157 8 | 70 9 | -------------------------------------------------------------------------------- /tests/2022/04/0.txt: -------------------------------------------------------------------------------- 1 | 2-4,6-8 2 | 2-3,4-5 3 | 5-7,7-9 4 | 2-8,3-7 5 | 6-6,4-6 6 | 2-6,4-8 7 | 2 8 | 4 9 | -------------------------------------------------------------------------------- /tests/2022/05/0.txt: -------------------------------------------------------------------------------- 1 | [D] 2 | [N] [C] 3 | [Z] [M] [P] 4 | 1 2 3 5 | 6 | move 1 from 2 to 1 7 | move 3 from 1 to 3 8 | move 2 from 2 to 1 9 | move 1 from 1 to 2 10 | CMZ 11 | MCD 12 | -------------------------------------------------------------------------------- /tests/2022/06/0.txt: -------------------------------------------------------------------------------- 1 | mjqjpqmgbljsphdztnvjfqwrcgsmlb 2 | 7 3 | 19 4 | -------------------------------------------------------------------------------- /tests/2022/06/1.txt: -------------------------------------------------------------------------------- 1 | bvwbjplbgvbhsrlpgdmjqwftvncz 2 | 5 3 | 23 4 | -------------------------------------------------------------------------------- /tests/2022/06/2.txt: -------------------------------------------------------------------------------- 1 | nppdvjthqldpwncqszvftbrmjlhg 2 | 6 3 | 23 4 | -------------------------------------------------------------------------------- /tests/2022/06/3.txt: -------------------------------------------------------------------------------- 1 | nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg 2 | 10 3 | 29 4 | -------------------------------------------------------------------------------- /tests/2022/06/4.txt: -------------------------------------------------------------------------------- 1 | zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw 2 | 11 3 | 26 4 | -------------------------------------------------------------------------------- /tests/2022/07/0.txt: -------------------------------------------------------------------------------- 1 | $ cd / 2 | $ ls 3 | dir a 4 | 14848514 b.txt 5 | 8504156 c.dat 6 | dir d 7 | $ cd a 8 | $ ls 9 | dir e 10 | 29116 f 11 | 2557 g 12 | 62596 h.lst 13 | $ cd e 14 | $ ls 15 | 584 i 16 | $ cd .. 17 | $ cd .. 18 | $ cd d 19 | $ ls 20 | 4060174 j 21 | 8033020 d.log 22 | 5626152 d.ext 23 | 7214296 k 24 | 95437 25 | 24933642 26 | -------------------------------------------------------------------------------- /tests/2022/08/0.txt: -------------------------------------------------------------------------------- 1 | 30373 2 | 25512 3 | 65332 4 | 33549 5 | 35390 6 | 21 7 | 8 8 | -------------------------------------------------------------------------------- /tests/2022/09/0.txt: -------------------------------------------------------------------------------- 1 | R 4 2 | U 4 3 | L 3 4 | D 1 5 | R 4 6 | D 1 7 | L 5 8 | R 2 9 | 13 10 | 1 11 | -------------------------------------------------------------------------------- /tests/2022/09/1.txt: -------------------------------------------------------------------------------- 1 | R 5 2 | U 8 3 | L 8 4 | D 3 5 | R 17 6 | D 10 7 | L 25 8 | U 20 9 | - 10 | 36 11 | -------------------------------------------------------------------------------- /tests/2022/12/0.txt: -------------------------------------------------------------------------------- 1 | Sabqponm 2 | abcryxxl 3 | accszExk 4 | acctuvwj 5 | abdefghi 6 | 31 7 | 29 8 | -------------------------------------------------------------------------------- /tests/2022/13/0.txt: -------------------------------------------------------------------------------- 1 | [1,1,3,1,1] 2 | [1,1,5,1,1] 3 | 4 | [[1],[2,3,4]] 5 | [[1],4] 6 | 7 | [9] 8 | [[8,7,6]] 9 | 10 | [[4,4],4,4] 11 | [[4,4],4,4,4] 12 | 13 | [7,7,7,7] 14 | [7,7,7] 15 | 16 | [] 17 | [3] 18 | 19 | [[[]]] 20 | [[]] 21 | 22 | [1,[2,[3,[4,[5,6,7]]]],8,9] 23 | [1,[2,[3,[4,[5,6,0]]]],8,9] 24 | 13 25 | 140 26 | -------------------------------------------------------------------------------- /tests/2022/14/0.txt: -------------------------------------------------------------------------------- 1 | 498,4 -> 498,6 -> 496,6 2 | 503,4 -> 502,4 -> 502,9 -> 494,9 3 | 24 4 | 93 5 | -------------------------------------------------------------------------------- /tests/2022/16/0.txt: -------------------------------------------------------------------------------- 1 | Valve AA has flow rate=0; tunnels lead to valves DD, II, BB 2 | Valve BB has flow rate=13; tunnels lead to valves CC, AA 3 | Valve CC has flow rate=2; tunnels lead to valves DD, BB 4 | Valve DD has flow rate=20; tunnels lead to valves CC, AA, EE 5 | Valve EE has flow rate=3; tunnels lead to valves FF, DD 6 | Valve FF has flow rate=0; tunnels lead to valves EE, GG 7 | Valve GG has flow rate=0; tunnels lead to valves FF, HH 8 | Valve HH has flow rate=22; tunnel leads to valve GG 9 | Valve II has flow rate=0; tunnels lead to valves AA, JJ 10 | Valve JJ has flow rate=21; tunnel leads to valve II 11 | 1651 12 | 1707 13 | -------------------------------------------------------------------------------- /tests/2022/17/0.txt: -------------------------------------------------------------------------------- 1 | >>><<><>><<<>><>>><<<>>><<<><<<>><>><<>> 2 | 3068 3 | 1514285714288 4 | -------------------------------------------------------------------------------- /tests/2022/18/0.txt: -------------------------------------------------------------------------------- 1 | 1,1,1 2 | 2,1,1 3 | 10 4 | 10 5 | -------------------------------------------------------------------------------- /tests/2022/18/1.txt: -------------------------------------------------------------------------------- 1 | 2,2,2 2 | 1,2,2 3 | 3,2,2 4 | 2,1,2 5 | 2,3,2 6 | 2,2,1 7 | 2,2,3 8 | 2,2,4 9 | 2,2,6 10 | 1,2,5 11 | 3,2,5 12 | 2,1,5 13 | 2,3,5 14 | 64 15 | 58 16 | -------------------------------------------------------------------------------- /tests/2022/19/0.txt: -------------------------------------------------------------------------------- 1 | Blueprint 1: 2 | Each ore robot costs 4 ore. 3 | Each clay robot costs 2 ore. 4 | Each obsidian robot costs 3 ore and 14 clay. 5 | Each geode robot costs 2 ore and 7 obsidian. 6 | 7 | Blueprint 2: 8 | Each ore robot costs 2 ore. 9 | Each clay robot costs 3 ore. 10 | Each obsidian robot costs 3 ore and 8 clay. 11 | Each geode robot costs 3 ore and 12 obsidian. 12 | 33 13 | 3472 # 56 * 62 14 | -------------------------------------------------------------------------------- /tests/2022/20/0.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | -3 4 | 3 5 | -2 6 | 0 7 | 4 8 | 3 9 | 1623178306 10 | -------------------------------------------------------------------------------- /tests/2022/21/0.txt: -------------------------------------------------------------------------------- 1 | root: pppw + sjmn 2 | dbpl: 5 3 | cczh: sllz + lgvd 4 | zczc: 2 5 | ptdq: humn - dvpt 6 | dvpt: 3 7 | lfqf: 4 8 | humn: 5 9 | ljgn: 2 10 | sjmn: drzm * dbpl 11 | sllz: 4 12 | pppw: cczh / lfqf 13 | lgvd: ljgn * ptdq 14 | drzm: hmdt - zczc 15 | hmdt: 32 16 | 152 17 | 301 18 | -------------------------------------------------------------------------------- /tests/2022/22/0.txt: -------------------------------------------------------------------------------- 1 | ...# 2 | .#.. 3 | #... 4 | .... 5 | ...#.......# 6 | ........#... 7 | ..#....#.... 8 | ..........#. 9 | ...#.... 10 | .....#.. 11 | .#...... 12 | ......#. 13 | 14 | 10R5L5R10L4R5L5 15 | 6032 16 | 5031 17 | -------------------------------------------------------------------------------- /tests/2022/23/0.txt: -------------------------------------------------------------------------------- 1 | ..... 2 | ..##. 3 | ..#.. 4 | ..... 5 | ..##. 6 | ..... 7 | 25 8 | 4 9 | -------------------------------------------------------------------------------- /tests/2022/23/1.txt: -------------------------------------------------------------------------------- 1 | ....#.. 2 | ..###.# 3 | #...#.# 4 | .#...## 5 | #.###.. 6 | ##.#.## 7 | .#..#.. 8 | 110 9 | 20 10 | -------------------------------------------------------------------------------- /tests/2022/24/0.txt: -------------------------------------------------------------------------------- 1 | #.###### 2 | #>>.<^<# 3 | #.<..<<# 4 | #>v.><># 5 | #<^v^^># 6 | ######.# 7 | 18 8 | 54 9 | -------------------------------------------------------------------------------- /tests/2022/25/0.txt: -------------------------------------------------------------------------------- 1 | 1=-0-2 2 | 12111 3 | 2=0= 4 | 21 5 | 2=01 6 | 111 7 | 20012 8 | 112 9 | 1=-1= 10 | 1-12 11 | 12 12 | 1= 13 | 122 14 | 2=-1=0 15 | - 16 | -------------------------------------------------------------------------------- /tests/2023/01/0.txt: -------------------------------------------------------------------------------- 1 | 1abc2 2 | pqr3stu8vwx 3 | a1b2c3d4e5f 4 | treb7uchet 5 | 142 6 | - 7 | -------------------------------------------------------------------------------- /tests/2023/01/1.txt: -------------------------------------------------------------------------------- 1 | two1nine 2 | eightwothree 3 | abcone2threexyz 4 | xtwone3four 5 | 4nineeightseven2 6 | zoneight234 7 | 7pqrstsixteen 8 | - 9 | 281 10 | -------------------------------------------------------------------------------- /tests/2023/02/0.txt: -------------------------------------------------------------------------------- 1 | Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green 2 | Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue 3 | Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red 4 | Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red 5 | Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green 6 | 8 7 | 2286 8 | -------------------------------------------------------------------------------- /tests/2023/03/0.txt: -------------------------------------------------------------------------------- 1 | 467..114.. 2 | ...*...... 3 | ..35..633. 4 | ......#... 5 | 617*...... 6 | .....+.58. 7 | ..592..... 8 | ......755. 9 | ...$.*.... 10 | .664.598.. 11 | 4361 12 | 467835 13 | -------------------------------------------------------------------------------- /tests/2023/03/Full-Mathematician-7.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 200 3 | 0 4 | 0 5 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/comment/kbt6ez9/ 6 | -------------------------------------------------------------------------------- /tests/2023/03/IsatisCrucifer.txt: -------------------------------------------------------------------------------- 1 | ........ 2 | .24..4.. 3 | ......*. 4 | 4 5 | 0 6 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/comment/kbt0vh8/ 7 | -------------------------------------------------------------------------------- /tests/2023/03/WorldOfSoap.txt: -------------------------------------------------------------------------------- 1 | .....24.*23. 2 | ..10........ 3 | ..397*.610.. 4 | .......50... 5 | 1*2..4...... 6 | - 7 | 2 8 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/comment/kbte5k3/ 9 | -------------------------------------------------------------------------------- /tests/2023/03/_Merxer_.txt: -------------------------------------------------------------------------------- 1 | 333.3 2 | ...*. 3 | 336 4 | 999 5 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/comment/kbszvpr/ 6 | -------------------------------------------------------------------------------- /tests/2023/03/i_have_no_biscuits.1.txt: -------------------------------------------------------------------------------- 1 | 12.......*.. 2 | +.........34 3 | .......-12.. 4 | ..78........ 5 | ..*....60... 6 | 78.........9 7 | .5.....23..$ 8 | 8...90*12... 9 | ............ 10 | 2.2......12. 11 | .*.........* 12 | 1.1..503+.56 13 | 925 14 | 6756 15 | # user example with many edge cases 16 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/2023_day_3_another_sample_grid_to_use/ 17 | -------------------------------------------------------------------------------- /tests/2023/03/i_have_no_biscuits.2.txt: -------------------------------------------------------------------------------- 1 | .................... 2 | ..-52..52-..52..52.. 3 | ..................-. 4 | 156 5 | 0 6 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/comment/kbt2yp5/ 7 | -------------------------------------------------------------------------------- /tests/2023/03/i_have_no_biscuits.3.txt: -------------------------------------------------------------------------------- 1 | ....11 2 | ...... 3 | ....22 4 | 33+... 5 | ...... 6 | 44+.44 7 | ...... 8 | +55.55 9 | .....+ 10 | 187 11 | - 12 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/comment/kby4a4z/ 13 | -------------------------------------------------------------------------------- /tests/2023/03/musifter.txt: -------------------------------------------------------------------------------- 1 | .......5...... 2 | ..7*..*....... 3 | ...*13*....... 4 | .......15..... 5 | 40 6 | 442 7 | # https://www.reddit.com/r/adventofcode/comments/189q9wv/comment/kbsrno0/ 8 | -------------------------------------------------------------------------------- /tests/2023/04/0.txt: -------------------------------------------------------------------------------- 1 | Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53 2 | Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19 3 | Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1 4 | Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83 5 | Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36 6 | Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11 7 | 13 8 | 30 9 | -------------------------------------------------------------------------------- /tests/2023/05/0.txt: -------------------------------------------------------------------------------- 1 | seeds: 79 14 55 13 2 | 3 | seed-to-soil map: 4 | 50 98 2 5 | 52 50 48 6 | 7 | soil-to-fertilizer map: 8 | 0 15 37 9 | 37 52 2 10 | 39 0 15 11 | 12 | fertilizer-to-water map: 13 | 49 53 8 14 | 0 11 42 15 | 42 0 7 16 | 57 7 4 17 | 18 | water-to-light map: 19 | 88 18 7 20 | 18 25 70 21 | 22 | light-to-temperature map: 23 | 45 77 23 24 | 81 45 19 25 | 68 64 13 26 | 27 | temperature-to-humidity map: 28 | 0 69 1 29 | 1 0 69 30 | 31 | humidity-to-location map: 32 | 60 56 37 33 | 56 93 4 34 | 35 35 | 46 36 | -------------------------------------------------------------------------------- /tests/2023/06/0.txt: -------------------------------------------------------------------------------- 1 | Time: 7 15 30 2 | Distance: 9 40 200 3 | 288 4 | 71503 5 | -------------------------------------------------------------------------------- /tests/2023/07/0.txt: -------------------------------------------------------------------------------- 1 | 32T3K 765 2 | T55J5 684 3 | KK677 28 4 | KTJJT 220 5 | QQQJA 483 6 | 6440 7 | 5905 8 | -------------------------------------------------------------------------------- /tests/2023/07/LxsterGames.txt: -------------------------------------------------------------------------------- 1 | 2345A 1 2 | Q2KJJ 13 3 | Q2Q2Q 19 4 | T3T3J 17 5 | T3Q33 11 6 | 2345J 3 7 | J345A 2 8 | 32T3K 5 9 | T55J5 29 10 | KK677 7 11 | KTJJT 34 12 | QQQJA 31 13 | JJJJJ 37 14 | JAAAA 43 15 | AAAAJ 59 16 | AAAAA 61 17 | 2AAAA 23 18 | 2JJJJ 53 19 | JJJJ2 41 20 | 6592 21 | 6839 22 | # user example with many edge cases 23 | # https://www.reddit.com/r/adventofcode/comments/18cr4xr/2023_day_7_better_example_input_not_a_spoiler/ 24 | -------------------------------------------------------------------------------- /tests/2023/07/jwolf.txt: -------------------------------------------------------------------------------- 1 | QQQJA 483 2 | KTJJT 220 3 | QQQJA 483 4 | QQQJA 483 5 | 4567 6 | 3778 7 | -------------------------------------------------------------------------------- /tests/2023/08/0.txt: -------------------------------------------------------------------------------- 1 | RL 2 | 3 | AAA = (BBB, CCC) 4 | BBB = (DDD, EEE) 5 | CCC = (ZZZ, GGG) 6 | DDD = (DDD, DDD) 7 | EEE = (EEE, EEE) 8 | GGG = (GGG, GGG) 9 | ZZZ = (ZZZ, ZZZ) 10 | 2 11 | - 12 | -------------------------------------------------------------------------------- /tests/2023/08/1.txt: -------------------------------------------------------------------------------- 1 | LLR 2 | 3 | AAA = (BBB, BBB) 4 | BBB = (AAA, ZZZ) 5 | ZZZ = (ZZZ, ZZZ) 6 | 6 7 | - 8 | -------------------------------------------------------------------------------- /tests/2023/08/2.txt: -------------------------------------------------------------------------------- 1 | LR 2 | 3 | 11A = (11B, XXX) 4 | 11B = (XXX, 11Z) 5 | 11Z = (11B, XXX) 6 | 22A = (22B, XXX) 7 | 22B = (22C, 22C) 8 | 22C = (22Z, 22Z) 9 | 22Z = (22B, 22B) 10 | XXX = (XXX, XXX) 11 | - 12 | 6 13 | -------------------------------------------------------------------------------- /tests/2023/09/0.txt: -------------------------------------------------------------------------------- 1 | 0 3 6 9 12 15 2 | 1 3 6 10 15 21 3 | 10 13 16 21 30 45 4 | 114 5 | 2 6 | -------------------------------------------------------------------------------- /tests/2023/10/0.txt: -------------------------------------------------------------------------------- 1 | ..... 2 | .S-7. 3 | .|.|. 4 | .L-J. 5 | ..... 6 | 4 7 | - 8 | -------------------------------------------------------------------------------- /tests/2023/10/1.txt: -------------------------------------------------------------------------------- 1 | ..F7. 2 | .FJ|. 3 | SJ.L7 4 | |F--J 5 | LJ... 6 | 8 7 | - 8 | -------------------------------------------------------------------------------- /tests/2023/10/2.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .S-------7. 3 | .|F-----7|. 4 | .||.....||. 5 | .||.....||. 6 | .|L-7.F-J|. 7 | .|..|.|..|. 8 | .L--J.L--J. 9 | ........... 10 | - 11 | 4 12 | -------------------------------------------------------------------------------- /tests/2023/10/3.txt: -------------------------------------------------------------------------------- 1 | .......... 2 | .S------7. 3 | .|F----7|. 4 | .||OOOO||. 5 | .||OOOO||. 6 | .|L-7F-J|. 7 | .|II||II|. 8 | .L--JL--J. 9 | .......... 10 | - 11 | 4 12 | -------------------------------------------------------------------------------- /tests/2023/10/4.txt: -------------------------------------------------------------------------------- 1 | .F----7F7F7F7F-7.... 2 | .|F--7||||||||FJ.... 3 | .||.FJ||||||||L7.... 4 | FJL7L7LJLJ||LJ.L-7.. 5 | L--J.L7...LJS7F-7L7. 6 | ....F-J..F7FJ|L7L7L7 7 | ....L7.F7||L7|.L7L7| 8 | .....|FJLJ|FJ|F7|.LJ 9 | ....FJL-7.||.||||... 10 | ....L---J.LJ.LJLJ... 11 | - 12 | 8 13 | -------------------------------------------------------------------------------- /tests/2023/10/5.txt: -------------------------------------------------------------------------------- 1 | FF7FSF7F7F7F7F7F---7 2 | L|LJ||||||||||||F--J 3 | FL-7LJLJ||||||LJL-77 4 | F--JF--7||LJLJ7F7FJ- 5 | L---JF-JLJ.||-FJLJJ7 6 | |F|F-JF---7F7-L7L|7| 7 | |FFJF7L7F-JF7|JL---7 8 | 7-L-JL7||F7|L7F-7F7| 9 | L.L7LFJ|||||FJL7||LJ 10 | L7JLJL-JLJLJL--JLJ.L 11 | - 12 | 10 13 | -------------------------------------------------------------------------------- /tests/2023/11/0.txt: -------------------------------------------------------------------------------- 1 | ...#...... 2 | .......#.. 3 | #......... 4 | .......... 5 | ......#... 6 | .#........ 7 | .........# 8 | .......... 9 | .......#.. 10 | #...#..... 11 | 374 12 | 8410 # expansion_factor=100 13 | -------------------------------------------------------------------------------- /tests/2023/12/0.txt: -------------------------------------------------------------------------------- 1 | ???.### 1,1,3 2 | .??..??...?##. 1,1,3 3 | ?#?#?#?#?#?#?#? 1,3,1,6 4 | ????.#...#... 4,1,1 5 | ????.######..#####. 1,6,5 6 | ?###???????? 3,2,1 7 | 21 8 | 525152 9 | -------------------------------------------------------------------------------- /tests/2023/13/0.txt: -------------------------------------------------------------------------------- 1 | #.##..##. 2 | ..#.##.#. 3 | ##......# 4 | ##......# 5 | ..#.##.#. 6 | ..##..##. 7 | #.#.##.#. 8 | 9 | #...##..# 10 | #....#..# 11 | ..##..### 12 | #####.##. 13 | #####.##. 14 | ..##..### 15 | #....#..# 16 | 405 17 | 400 18 | -------------------------------------------------------------------------------- /tests/2023/14/0.txt: -------------------------------------------------------------------------------- 1 | O....#.... 2 | O.OO#....# 3 | .....##... 4 | OO.#O....O 5 | .O.....O#. 6 | O.#..O.#.# 7 | ..O..#O..O 8 | .......O.. 9 | #....###.. 10 | #OO..#.... 11 | 136 12 | 64 13 | -------------------------------------------------------------------------------- /tests/2023/15/0.txt: -------------------------------------------------------------------------------- 1 | rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7 2 | 1320 3 | 145 4 | -------------------------------------------------------------------------------- /tests/2023/16/0.txt: -------------------------------------------------------------------------------- 1 | .|...\.... 2 | |.-.\..... 3 | .....|-... 4 | ........|. 5 | .......... 6 | .........\ 7 | ..../.\\.. 8 | .-.-/..|.. 9 | .|....-|.\ 10 | ..//.|.... 11 | 46 12 | 51 13 | -------------------------------------------------------------------------------- /tests/2023/17/0.txt: -------------------------------------------------------------------------------- 1 | 2413432311323 2 | 3215453535623 3 | 3255245654254 4 | 3446585845452 5 | 4546657867536 6 | 1438598798454 7 | 4457876987766 8 | 3637877979653 9 | 4654967986887 10 | 4564679986453 11 | 1224686865563 12 | 2546548887735 13 | 4322674655533 14 | 102 15 | 94 16 | -------------------------------------------------------------------------------- /tests/2023/17/1.txt: -------------------------------------------------------------------------------- 1 | 111111111111 2 | 999999999991 3 | 999999999991 4 | 999999999991 5 | 999999999991 6 | - 7 | 71 8 | -------------------------------------------------------------------------------- /tests/2023/17/IsatisCrucifer.txt: -------------------------------------------------------------------------------- 1 | 11199 2 | 12199 3 | 99199 4 | 99131 5 | 99111 6 | 9 7 | 40 8 | # User example from reddit https://www.reddit.com/r/adventofcode/comments/18khohi/comment/kdr7o7r/ 9 | -------------------------------------------------------------------------------- /tests/2023/17/gabrielchl.txt: -------------------------------------------------------------------------------- 1 | 55599 2 | 57599 3 | 99599 4 | 99599 5 | 99555 6 | 99955 7 | 47 8 | 65 9 | # from https://www.reddit.com/r/adventofcode/comments/18kewly/comment/kdr2dku/ 10 | -------------------------------------------------------------------------------- /tests/2023/18/0.txt: -------------------------------------------------------------------------------- 1 | R 6 (#70c710) 2 | D 5 (#0dc571) 3 | L 2 (#5713f0) 4 | D 2 (#d2c081) 5 | R 2 (#59c680) 6 | D 2 (#411b91) 7 | L 5 (#8ceee2) 8 | U 2 (#caa173) 9 | L 1 (#1b58a2) 10 | U 2 (#caa171) 11 | R 2 (#7807d2) 12 | U 3 (#a77fa3) 13 | L 2 (#015232) 14 | U 2 (#7a21e3) 15 | 62 16 | 952408144115 17 | -------------------------------------------------------------------------------- /tests/2023/19/0.txt: -------------------------------------------------------------------------------- 1 | px{a<2006:qkq,m>2090:A,rfg} 2 | pv{a>1716:R,A} 3 | lnx{m>1548:A,A} 4 | rfg{s<537:gd,x>2440:R,A} 5 | qs{s>3448:A,lnx} 6 | qkq{x<1416:A,crn} 7 | crn{x>2662:A,R} 8 | in{s<1351:px,qqz} 9 | qqz{s>2770:qs,m<1801:hdj,R} 10 | gd{a>3333:R,R} 11 | hdj{m>838:A,pv} 12 | 13 | {x=787,m=2655,a=1222,s=2876} 14 | {x=1679,m=44,a=2067,s=496} 15 | {x=2036,m=264,a=79,s=2244} 16 | {x=2461,m=1339,a=466,s=291} 17 | {x=2127,m=1623,a=2188,s=1013} 18 | 19114 19 | 167409079868000 20 | -------------------------------------------------------------------------------- /tests/2023/20/0.txt: -------------------------------------------------------------------------------- 1 | broadcaster -> a, b, c 2 | %a -> b 3 | %b -> c 4 | %c -> inv 5 | &inv -> a 6 | 32000000 7 | - 8 | -------------------------------------------------------------------------------- /tests/2023/20/1.txt: -------------------------------------------------------------------------------- 1 | broadcaster -> a 2 | %a -> inv, con 3 | &inv -> b 4 | %b -> con 5 | &con -> output 6 | 11687500 7 | - 8 | -------------------------------------------------------------------------------- /tests/2023/21/0.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .....###.#. 3 | .###.##..#. 4 | ..#.#...#.. 5 | ....#.#.... 6 | .##..S####. 7 | .##..#...#. 8 | .......##.. 9 | .##.#.####. 10 | .##..##.##. 11 | ........... 12 | 16 13 | 16 # n_steps=6 14 | -------------------------------------------------------------------------------- /tests/2023/21/1.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .....###.#. 3 | .###.##..#. 4 | ..#.#...#.. 5 | ....#.#.... 6 | .##..S####. 7 | .##..#...#. 8 | .......##.. 9 | .##.#.####. 10 | .##..##.##. 11 | ........... 12 | - 13 | 50 # n_steps=10 14 | -------------------------------------------------------------------------------- /tests/2023/21/2.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .....###.#. 3 | .###.##..#. 4 | ..#.#...#.. 5 | ....#.#.... 6 | .##..S####. 7 | .##..#...#. 8 | .......##.. 9 | .##.#.####. 10 | .##..##.##. 11 | ........... 12 | - 13 | 1594 # n_steps=50 14 | -------------------------------------------------------------------------------- /tests/2023/21/3.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .....###.#. 3 | .###.##..#. 4 | ..#.#...#.. 5 | ....#.#.... 6 | .##..S####. 7 | .##..#...#. 8 | .......##.. 9 | .##.#.####. 10 | .##..##.##. 11 | ........... 12 | - 13 | 6536 # n_steps=100 14 | -------------------------------------------------------------------------------- /tests/2023/21/4.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .....###.#. 3 | .###.##..#. 4 | ..#.#...#.. 5 | ....#.#.... 6 | .##..S####. 7 | .##..#...#. 8 | .......##.. 9 | .##.#.####. 10 | .##..##.##. 11 | ........... 12 | - 13 | 167004 # n_steps=500 14 | -------------------------------------------------------------------------------- /tests/2023/21/5.slow.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .....###.#. 3 | .###.##..#. 4 | ..#.#...#.. 5 | ....#.#.... 6 | .##..S####. 7 | .##..#...#. 8 | .......##.. 9 | .##.#.####. 10 | .##..##.##. 11 | ........... 12 | - 13 | 668697 # n_steps=1000 14 | -------------------------------------------------------------------------------- /tests/2023/21/6.slow.txt: -------------------------------------------------------------------------------- 1 | ........... 2 | .....###.#. 3 | .###.##..#. 4 | ..#.#...#.. 5 | ....#.#.... 6 | .##..S####. 7 | .##..#...#. 8 | .......##.. 9 | .##.#.####. 10 | .##..##.##. 11 | ........... 12 | - 13 | 16733044 # n_steps=5000 14 | -------------------------------------------------------------------------------- /tests/2023/22/0.txt: -------------------------------------------------------------------------------- 1 | 1,0,1~1,2,1 2 | 0,0,2~2,0,2 3 | 0,2,3~2,2,3 4 | 0,0,4~0,2,4 5 | 2,0,5~2,2,5 6 | 0,1,6~2,1,6 7 | 1,1,8~1,1,9 8 | 5 9 | 7 10 | -------------------------------------------------------------------------------- /tests/2023/23/0.txt: -------------------------------------------------------------------------------- 1 | #.##################### 2 | #.......#########...### 3 | #######.#########.#.### 4 | ###.....#.>.>.###.#.### 5 | ###v#####.#v#.###.#.### 6 | ###.>...#.#.#.....#...# 7 | ###v###.#.#.#########.# 8 | ###...#.#.#.......#...# 9 | #####.#.#.#######.#.### 10 | #.....#.#.#.......#...# 11 | #.#####.#.#.#########v# 12 | #.#...#...#...###...>.# 13 | #.#.#v#######v###.###v# 14 | #...#.>.#...>.>.#.###.# 15 | #####v#.#.###v#.#.###.# 16 | #.....#...#...#.#.#...# 17 | #.#########.###.#.#.### 18 | #...###...#...#...#.### 19 | ###.###.#.###v#####v### 20 | #...#...#.#.>.>.#.>.### 21 | #.###.###.#.###.#.#v### 22 | #.....###...###...#...# 23 | #####################.# 24 | 94 25 | 154 26 | -------------------------------------------------------------------------------- /tests/2023/24/0.txt: -------------------------------------------------------------------------------- 1 | 19, 13, 30 @ -2, 1, -2 2 | 18, 19, 22 @ -1, -1, -2 3 | 20, 25, 34 @ -2, -2, -4 4 | 12, 31, 28 @ -1, -2, -1 5 | 20, 19, 15 @ 1, -5, -3 6 | 2 # test_area_min=7,test_area_max=27 7 | 47 8 | -------------------------------------------------------------------------------- /tests/2023/25/0.txt: -------------------------------------------------------------------------------- 1 | jqt: rhn xhk nvd 2 | rsh: frs pzl lsr 3 | xhk: hfx 4 | cmg: qnr nvd lhk bvb 5 | rhn: xhk bvb hfx 6 | bvb: xhk hfx 7 | pzl: lsr hfx nvd 8 | qnr: nvd 9 | ntq: jqt hfx bvb xhk 10 | nvd: lhk 11 | lsr: lhk 12 | rzs: qnr cmg lsr rsh 13 | frs: qnr lhk lsr 14 | 54 15 | - 16 | -------------------------------------------------------------------------------- /tests/2024/01/0.txt: -------------------------------------------------------------------------------- 1 | 3 4 2 | 4 3 3 | 2 5 4 | 1 3 5 | 3 9 6 | 3 3 7 | 11 8 | 31 9 | -------------------------------------------------------------------------------- /tests/2024/02/0.txt: -------------------------------------------------------------------------------- 1 | 7 6 4 2 1 2 | 1 2 7 8 9 3 | 9 7 6 2 1 4 | 1 3 2 4 5 5 | 8 6 4 4 1 6 | 1 3 6 7 9 7 | 2 8 | 4 9 | -------------------------------------------------------------------------------- /tests/2024/03/0.txt: -------------------------------------------------------------------------------- 1 | xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5)) 2 | 161 3 | - 4 | -------------------------------------------------------------------------------- /tests/2024/03/1.txt: -------------------------------------------------------------------------------- 1 | xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5)) 2 | - 3 | 48 4 | -------------------------------------------------------------------------------- /tests/2024/04/0.txt: -------------------------------------------------------------------------------- 1 | MMMSXXMASM 2 | MSAMXMSMSA 3 | AMXSXMAAMM 4 | MSAMASMSMX 5 | XMASAMXAMM 6 | XXAMMXXAMA 7 | SMSMSASXSS 8 | SAXAMASAAA 9 | MAMMMXMMMM 10 | MXMXAXMASX 11 | 18 12 | 9 13 | -------------------------------------------------------------------------------- /tests/2024/05/0.txt: -------------------------------------------------------------------------------- 1 | 47|53 2 | 97|13 3 | 97|61 4 | 97|47 5 | 75|29 6 | 61|13 7 | 75|53 8 | 29|13 9 | 97|29 10 | 53|29 11 | 61|53 12 | 97|53 13 | 61|29 14 | 47|13 15 | 75|47 16 | 97|75 17 | 47|61 18 | 75|61 19 | 47|29 20 | 75|13 21 | 53|13 22 | 23 | 75,47,61,53,29 24 | 97,61,53,29,13 25 | 75,29,13 26 | 75,97,47,61,53 27 | 61,13,29 28 | 97,13,75,29,47 29 | 143 30 | 123 31 | -------------------------------------------------------------------------------- /tests/2024/06/0.txt: -------------------------------------------------------------------------------- 1 | ....#..... 2 | .........# 3 | .......... 4 | ..#....... 5 | .......#.. 6 | .......... 7 | .#..^..... 8 | ........#. 9 | #......... 10 | ......#... 11 | 41 12 | 6 13 | -------------------------------------------------------------------------------- /tests/2024/07/0.txt: -------------------------------------------------------------------------------- 1 | 190: 10 19 2 | 3267: 81 40 27 3 | 83: 17 5 4 | 156: 15 6 5 | 7290: 6 8 6 15 6 | 161011: 16 10 13 7 | 192: 17 8 14 8 | 21037: 9 7 18 13 9 | 292: 11 6 16 20 10 | 3749 11 | 11387 12 | -------------------------------------------------------------------------------- /tests/2024/08/0.txt: -------------------------------------------------------------------------------- 1 | ............ 2 | ........0... 3 | .....0...... 4 | .......0.... 5 | ....0....... 6 | ......A..... 7 | ............ 8 | ............ 9 | ........A... 10 | .........A.. 11 | ............ 12 | ............ 13 | 14 14 | 34 15 | -------------------------------------------------------------------------------- /tests/2024/08/1.txt: -------------------------------------------------------------------------------- 1 | T....#.... 2 | ...T...... 3 | .T....#... 4 | .........# 5 | ..#....... 6 | .......... 7 | ...#...... 8 | .......... 9 | ....#..... 10 | .......... 11 | - 12 | 9 13 | -------------------------------------------------------------------------------- /tests/2024/09/0.txt: -------------------------------------------------------------------------------- 1 | 2333133121414131402 2 | 1928 3 | 2858 4 | -------------------------------------------------------------------------------- /tests/2024/10/0.txt: -------------------------------------------------------------------------------- 1 | 89010123 2 | 78121874 3 | 87430965 4 | 96549874 5 | 45678903 6 | 32019012 7 | 01329801 8 | 10456732 9 | 36 10 | 81 11 | -------------------------------------------------------------------------------- /tests/2024/11/0.txt: -------------------------------------------------------------------------------- 1 | 125 17 2 | 55312 3 | - 4 | -------------------------------------------------------------------------------- /tests/2024/12/0.txt: -------------------------------------------------------------------------------- 1 | AAAA 2 | BBCD 3 | BBCC 4 | EEEC 5 | 140 6 | 80 7 | -------------------------------------------------------------------------------- /tests/2024/12/1.txt: -------------------------------------------------------------------------------- 1 | OOOOO 2 | OXOXO 3 | OOOOO 4 | OXOXO 5 | OOOOO 6 | 772 7 | 436 8 | -------------------------------------------------------------------------------- /tests/2024/12/2.txt: -------------------------------------------------------------------------------- 1 | RRRRIICCFF 2 | RRRRIICCCF 3 | VVRRRCCFFF 4 | VVRCCCJFFF 5 | VVVVCJJCFE 6 | VVIVCCJJEE 7 | VVIIICJJEE 8 | MIIIIIJJEE 9 | MIIISIJEEE 10 | MMMISSJEEE 11 | 1930 12 | 1206 13 | -------------------------------------------------------------------------------- /tests/2024/12/3.txt: -------------------------------------------------------------------------------- 1 | EEEEE 2 | EXXXX 3 | EEEEE 4 | EXXXX 5 | EEEEE 6 | - 7 | 236 8 | -------------------------------------------------------------------------------- /tests/2024/12/4.txt: -------------------------------------------------------------------------------- 1 | AAAAAA 2 | AAABBA 3 | AAABBA 4 | ABBAAA 5 | ABBAAA 6 | AAAAAA 7 | - 8 | 368 9 | -------------------------------------------------------------------------------- /tests/2024/13/0.txt: -------------------------------------------------------------------------------- 1 | Button A: X+94, Y+34 2 | Button B: X+22, Y+67 3 | Prize: X=8400, Y=5400 4 | 5 | Button A: X+26, Y+66 6 | Button B: X+67, Y+21 7 | Prize: X=12748, Y=12176 8 | 9 | Button A: X+17, Y+86 10 | Button B: X+84, Y+37 11 | Prize: X=7870, Y=6450 12 | 13 | Button A: X+69, Y+23 14 | Button B: X+27, Y+71 15 | Prize: X=18641, Y=10279 16 | 480 17 | - 18 | -------------------------------------------------------------------------------- /tests/2024/14/0.txt: -------------------------------------------------------------------------------- 1 | p=0,4 v=3,-3 2 | p=6,3 v=-1,-3 3 | p=10,3 v=-1,2 4 | p=2,0 v=2,-1 5 | p=0,0 v=1,3 6 | p=3,0 v=-2,-2 7 | p=7,6 v=-1,-3 8 | p=3,0 v=-1,-2 9 | p=9,3 v=2,3 10 | p=7,3 v=-1,2 11 | p=2,4 v=2,-3 12 | p=9,5 v=-3,-3 13 | 12 # width=11,height=7 14 | - 15 | -------------------------------------------------------------------------------- /tests/2024/15/0.txt: -------------------------------------------------------------------------------- 1 | ######## 2 | #..O.O.# 3 | ##@.O..# 4 | #...O..# 5 | #.#.O..# 6 | #...O..# 7 | #......# 8 | ######## 9 | 10 | <^^>>>vv>v<< 11 | 2028 12 | - 13 | -------------------------------------------------------------------------------- /tests/2024/16/0.txt: -------------------------------------------------------------------------------- 1 | ############### 2 | #.......#....E# 3 | #.#.###.#.###.# 4 | #.....#.#...#.# 5 | #.###.#####.#.# 6 | #.#.#.......#.# 7 | #.#.#####.###.# 8 | #...........#.# 9 | ###.#.#####.#.# 10 | #...#.....#.#.# 11 | #.#.#.###.#.#.# 12 | #.....#...#.#.# 13 | #.###.#.#.#.#.# 14 | #S..#.....#...# 15 | ############### 16 | 7036 17 | 45 18 | -------------------------------------------------------------------------------- /tests/2024/16/1.txt: -------------------------------------------------------------------------------- 1 | ################# 2 | #...#...#...#..E# 3 | #.#.#.#.#.#.#.#.# 4 | #.#.#.#...#...#.# 5 | #.#.#.#.###.#.#.# 6 | #...#.#.#.....#.# 7 | #.#.#.#.#.#####.# 8 | #.#...#.#.#.....# 9 | #.#.#####.#.###.# 10 | #.#.#.......#...# 11 | #.#.###.#####.### 12 | #.#.#...#.....#.# 13 | #.#.#.#####.###.# 14 | #.#.#.........#.# 15 | #.#.#.#########.# 16 | #S#.............# 17 | ################# 18 | 11048 19 | 64 20 | -------------------------------------------------------------------------------- /tests/2024/17/0.txt: -------------------------------------------------------------------------------- 1 | Register A: 729 2 | Register B: 0 3 | Register C: 0 4 | 5 | Program: 0,1,5,4,3,0 6 | 4,6,3,5,6,3,5,2,1,0 7 | - 8 | -------------------------------------------------------------------------------- /tests/2024/17/1.txt: -------------------------------------------------------------------------------- 1 | Register A: 2024 2 | Register B: 0 3 | Register C: 0 4 | 5 | Program: 0,3,5,4,3,0 6 | - 7 | 117440 8 | -------------------------------------------------------------------------------- /tests/2024/18/0.txt: -------------------------------------------------------------------------------- 1 | 5,4 2 | 4,2 3 | 4,5 4 | 3,0 5 | 2,1 6 | 6,3 7 | 2,4 8 | 1,5 9 | 0,6 10 | 3,3 11 | 2,6 12 | 5,1 13 | 1,2 14 | 5,5 15 | 2,5 16 | 6,5 17 | 1,4 18 | 0,4 19 | 6,4 20 | 1,1 21 | 6,1 22 | 1,0 23 | 0,5 24 | 1,6 25 | 2,0 26 | 22 # width=7,n_bytes=12 27 | 6,1 28 | -------------------------------------------------------------------------------- /tests/2024/19/0.txt: -------------------------------------------------------------------------------- 1 | r, wr, b, g, bwu, rb, gb, br 2 | 3 | brwrr 4 | bggr 5 | gbbr 6 | rrbgbr 7 | ubwu 8 | bwurrg 9 | brgr 10 | bbrgwb 11 | 6 12 | 16 13 | -------------------------------------------------------------------------------- /tests/2024/20/0.txt: -------------------------------------------------------------------------------- 1 | ############### 2 | #...#...#.....# 3 | #.#.#.#.#.###.# 4 | #S#...#.#.#...# 5 | #######.#.#.### 6 | #######.#.#...# 7 | #######.#.###.# 8 | ###..E#...#...# 9 | ###.#######.### 10 | #...###...#...# 11 | #.#####.#.###.# 12 | #.#...#.#.#...# 13 | #.#.#.#.#.#.### 14 | #...#...#...### 15 | ############### 16 | 44 # dt_min=2 17 | - 18 | -------------------------------------------------------------------------------- /tests/2024/20/1.txt: -------------------------------------------------------------------------------- 1 | ############### 2 | #...#...#.....# 3 | #.#.#.#.#.###.# 4 | #S#...#.#.#...# 5 | #######.#.#.### 6 | #######.#.#...# 7 | #######.#.###.# 8 | ###..E#...#...# 9 | ###.#######.### 10 | #...###...#...# 11 | #.#####.#.###.# 12 | #.#...#.#.#...# 13 | #.#.#.#.#.#.### 14 | #...#...#...### 15 | ############### 16 | - 17 | 285 # dt_min=50 18 | -------------------------------------------------------------------------------- /tests/2024/21/0.txt: -------------------------------------------------------------------------------- 1 | 029A 2 | 980A 3 | 179A 4 | 456A 5 | 379A 6 | 126384 7 | - 8 | -------------------------------------------------------------------------------- /tests/2024/22/0.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 10 3 | 100 4 | 2024 5 | 37327623 6 | - 7 | -------------------------------------------------------------------------------- /tests/2024/22/1.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 2024 5 | - 6 | 23 7 | -------------------------------------------------------------------------------- /tests/2024/23/0.txt: -------------------------------------------------------------------------------- 1 | kh-tc 2 | qp-kh 3 | de-cg 4 | ka-co 5 | yn-aq 6 | qp-ub 7 | cg-tb 8 | vc-aq 9 | tb-ka 10 | wh-tc 11 | yn-cg 12 | kh-ub 13 | ta-co 14 | de-co 15 | tc-td 16 | tb-wq 17 | wh-td 18 | ta-ka 19 | td-qp 20 | aq-cg 21 | wq-ub 22 | ub-vc 23 | de-ta 24 | wq-aq 25 | wq-vc 26 | wh-yn 27 | ka-de 28 | kh-ta 29 | co-tc 30 | wh-qp 31 | tb-vc 32 | td-yn 33 | 7 34 | co,de,ka,ta 35 | -------------------------------------------------------------------------------- /tests/2024/24/0.txt: -------------------------------------------------------------------------------- 1 | x00: 1 2 | x01: 1 3 | x02: 1 4 | y00: 0 5 | y01: 1 6 | y02: 0 7 | 8 | x00 AND y00 -> z00 9 | x01 XOR y01 -> z01 10 | x02 OR y02 -> z02 11 | 4 12 | - # n_swapped_pairs=0 13 | -------------------------------------------------------------------------------- /tests/2024/24/2.txt: -------------------------------------------------------------------------------- 1 | x00: 0 2 | x01: 1 3 | x02: 0 4 | x03: 1 5 | x04: 0 6 | x05: 1 7 | y00: 0 8 | y01: 0 9 | y02: 1 10 | y03: 1 11 | y04: 0 12 | y05: 1 13 | 14 | x00 AND y00 -> z05 15 | x01 AND y01 -> z02 16 | x02 AND y02 -> z01 17 | x03 AND y03 -> z03 18 | x04 AND y04 -> z04 19 | x05 AND y05 -> z00 20 | - 21 | z00,z01,z02,z05 # n_swapped_pairs=2,operation=bitwise_and 22 | -------------------------------------------------------------------------------- /tests/2024/25/0.txt: -------------------------------------------------------------------------------- 1 | ##### 2 | .#### 3 | .#### 4 | .#### 5 | .#.#. 6 | .#... 7 | ..... 8 | 9 | ##### 10 | ##.## 11 | .#.## 12 | ...## 13 | ...#. 14 | ...#. 15 | ..... 16 | 17 | ..... 18 | #.... 19 | #.... 20 | #...# 21 | #.#.# 22 | #.### 23 | ##### 24 | 25 | ..... 26 | ..... 27 | #.#.. 28 | ###.. 29 | ###.# 30 | ###.# 31 | ##### 32 | 33 | ..... 34 | ..... 35 | ..... 36 | #.... 37 | #.#.. 38 | #.#.# 39 | ##### 40 | 3 41 | - 42 | --------------------------------------------------------------------------------