advent-of-code-2024

My solutions to AoC 2024
Log | Files | Refs

day-15.lisp (1335B)


      1 (defpackage #:aoc-test/day-15
      2   (:use #:cl #:lisp-unit2)
      3   (:import-from #:aoc/day-15))
      4 (in-package #:aoc-test/day-15)
      5 
      6 (define-test test-day-15
      7     ()
      8   (assert= 2028 (aoc:run-day 15 "########
      9 #..O.O.#
     10 ##@.O..#
     11 #...O..#
     12 #.#.O..#
     13 #...O..#
     14 #......#
     15 ########
     16 
     17 <^^>>>vv<v>>v<<"))
     18   (multiple-value-bind (task-1 task-2)
     19       (aoc:run-day 15 "##########
     20 #..O..O.O#
     21 #......O.#
     22 #.OO..O.O#
     23 #..O@..O.#
     24 #O#..O...#
     25 #O..O..O.#
     26 #.OO.O.OO#
     27 #....O...#
     28 ##########
     29 
     30 <vv>^<v^>v>^vv^v>v<>v^v<v<^vv<<<^><<><>>v<vvv<>^v^>^<<<><<v<<<v^vv^v>^
     31 vvv<<^>^v^^><<>>><>^<<><^vv^^<>vvv<>><^^v>^>vv<>v<<<<v<^v>^<^^>>>^<v<v
     32 ><>vv>v^v^<>><>>>><^^>vv>v<^^^>>v^v^<^^>v^^>v^<^v>v<>>v^v^<v>v^^<^^vv<
     33 <<v<^>>^^^^>>>v^<>vvv^><v<<<>^^^vv^<vvv>^>v<^^^^v<>^>vvvv><>>v^<<^^^^^
     34 ^><^><>>><>^^<<^^v>>><^<v>^<vv>>v>>>^v><>^v><<<<v>>v<v<v>vvv>^<><<>^><
     35 ^>><>^v<><^vvv<^^<><v<<<<<><^v<<<><<<^^<v<^^^><^>>^<v^><<<^>>^v<v^v<v^
     36 >^>>^v>vv>^<<^v<>><<><<v<<v><>v<^vv<<<>^^v^>^^>>><<^v>>v^v><^^>>^<>vv^
     37 <><^^>^^^<><vvvvv^v<v<<>^v<v>v<<^><<><<><<<^^<<<^<<>><<><^^^>^^<>^>v<>
     38 ^^>vv<^v^v<vv>^<><v<^v>^^^>>>^^vvv^>vvv<>>>^<^>>>>>^<<^v>^vvv<>^<><<v>
     39 v^^>>><<^^<>>^v^<v^vv<>v^<<>^<^v^v><^<<<><<^<v><v<>vv>>v><v^<vv<>v^<<^")
     40     (assert= 10092 task-1)
     41     (assert= 9021 task-2))
     42   (assert= 618 (nth-value 1 (aoc:run-day 15 "#######
     43 #...#.#
     44 #.....#
     45 #..OO@#
     46 #..O..#
     47 #.....#
     48 #######
     49 
     50 <vv<<^^<<^^"))))