From c1fbb9fad499bd0d31992fc80f82f16fe90f7d6a Mon Sep 17 00:00:00 2001 From: Peter Tillemans Date: Mon, 23 Dec 2024 17:26:56 +0100 Subject: [PATCH] prep day 23 --- aoc.asd | 186 +++++++++++++++++++------------------ src/2024/day24.lisp | 42 +++++++++ tests/2024/day24-test.lisp | 27 ++++++ 3 files changed, 163 insertions(+), 92 deletions(-) create mode 100644 src/2024/day24.lisp create mode 100644 tests/2024/day24-test.lisp diff --git a/aoc.asd b/aoc.asd index b234ac5..28a5d4c 100644 --- a/aoc.asd +++ b/aoc.asd @@ -1,95 +1,97 @@ (defsystem "aoc" - :long-name "Advent of Code" - :version "0.1.0" - :author "Peter Tillemans" - :maintainer "Peter Tillemans" - :mailto "pti@snamellit.com" - :license "MIT" - :homepage "https://forge.snamellit.com/pti/aoc-cl" - :bug-tracker "https://forge.snamellit.com/pti/aoc-cl/issues" - :source-control "https://forge.snamellit.com/pti/aoc-cl" - :depends-on (#:dexador - #:cl-cookie - #:plump - #:lquery - #:3d-vectors - #:array-operations - #:lla - #:queues.simple-queue - #:queues.priority-queue - #:bt-semaphore ; threads higher level lib - #:trivia ; community standard pattern matching - #:transducers - #:smug - #:fset - #:arrow-macros - ) - :components ((:module "src" - :components - ((:file "main") - (:file "maze") - (:file "2018/day06") - (:file "2018/day07") - (:file "2024/day01") - (:file "2024/day02") - (:file "2024/day03") - (:file "2024/day04") - (:file "2024/day05") - (:file "2024/day06") - (:file "2024/day07") - (:file "2024/day08") - (:file "2024/day09") - (:file "2024/day10") - (:file "2024/day11") - (:file "2024/day12") - (:file "2024/day13") - (:file "2024/day14") - (:file "2024/day15") - (:file "2024/day16") - (:file "2024/day17") - (:file "2024/day18") - (:file "2024/day19") - (:file "2024/day20") - (:file "2024/day21") - (:file "2024/day22") - ))) - :description "Advent of Code challenges and solutions." - :long-description "Solutions for the AOC challenges." - :in-order-to ((test-op (test-op "aoc/tests")))) + :long-name "Advent of Code" + :version "0.1.0" + :author "Peter Tillemans" + :maintainer "Peter Tillemans" + :mailto "pti@snamellit.com" + :license "MIT" + :homepage "https://forge.snamellit.com/pti/aoc-cl" + :bug-tracker "https://forge.snamellit.com/pti/aoc-cl/issues" + :source-control "https://forge.snamellit.com/pti/aoc-cl" + :depends-on (#:dexador + #:cl-cookie + #:plump + #:lquery + #:3d-vectors + #:array-operations + #:lla + #:queues.simple-queue + #:queues.priority-queue + #:bt-semaphore ; threads higher level lib + #:trivia ; community standard pattern matching + #:transducers + #:smug + #:fset + #:arrow-macros + ) + :components ((:module "src" + :components + ((:file "main") + (:file "maze") + (:file "2018/day06") + (:file "2018/day07") + (:file "2024/day01") + (:file "2024/day02") + (:file "2024/day03") + (:file "2024/day04") + (:file "2024/day05") + (:file "2024/day06") + (:file "2024/day07") + (:file "2024/day08") + (:file "2024/day09") + (:file "2024/day10") + (:file "2024/day11") + (:file "2024/day12") + (:file "2024/day13") + (:file "2024/day14") + (:file "2024/day15") + (:file "2024/day16") + (:file "2024/day17") + (:file "2024/day18") + (:file "2024/day19") + (:file "2024/day20") + (:file "2024/day21") + (:file "2024/day22") + (:file "2024/day23") + ))) + :description "Advent of Code challenges and solutions." + :long-description "Solutions for the AOC challenges." + :in-order-to ((test-op (test-op "aoc/tests")))) (defsystem "aoc/tests" - :author "Peter Tillemans" - :license "GPL" - :depends-on ("aoc" - #:parachute) - :components ((:module "tests" - :components - ((:file "main") - (:file "2018/day06-test") - (:file "2018/day07-test") - (:file "2024/main") - (:file "2024/day01-test") - (:file "2024/day02-test") - (:file "2024/day03-test") - (:file "2024/day04-test") - (:file "2024/day05-test") - (:file "2024/day06-test") - (:file "2024/day07-test") - (:file "2024/day08-test") - (:file "2024/day09-test") - (:file "2024/day10-test") - (:file "2024/day11-test") - (:file "2024/day12-test") - (:file "2024/day13-test") - (:file "2024/day14-test") - (:file "2024/day15-test") - (:file "2024/day16-test") - (:file "2024/day17-test") - (:file "2024/day18-test") - (:file "2024/day19-test") - (:file "2024/day20-test") - (:file "2024/day21-test") - (:file "2024/day22-test") - ))) - :description "Test system for aoc" - :perform (test-op (op c) (symbol-call :parachute :test :aoc/tests))) + :author "Peter Tillemans" + :license "GPL" + :depends-on ("aoc" + #:parachute) + :components ((:module "tests" + :components + ((:file "main") + (:file "2018/day06-test") + (:file "2018/day07-test") + (:file "2024/main") + (:file "2024/day01-test") + (:file "2024/day02-test") + (:file "2024/day03-test") + (:file "2024/day04-test") + (:file "2024/day05-test") + (:file "2024/day06-test") + (:file "2024/day07-test") + (:file "2024/day08-test") + (:file "2024/day09-test") + (:file "2024/day10-test") + (:file "2024/day11-test") + (:file "2024/day12-test") + (:file "2024/day13-test") + (:file "2024/day14-test") + (:file "2024/day15-test") + (:file "2024/day16-test") + (:file "2024/day17-test") + (:file "2024/day18-test") + (:file "2024/day19-test") + (:file "2024/day20-test") + (:file "2024/day21-test") + (:file "2024/day22-test") + (:file "2024/day23-test") + ))) + :description "Test system for aoc" + :perform (test-op (op c) (symbol-call :parachute :test :aoc/tests))) diff --git a/src/2024/day24.lisp b/src/2024/day24.lisp new file mode 100644 index 0000000..a0483f8 --- /dev/null +++ b/src/2024/day24.lisp @@ -0,0 +1,42 @@ + +(defpackage :aoc/2024/24 + (:use :cl :aoc :alexandria :trivia :lla) + (:export + #:sample-data + #:sample-data2 + #:part1 + #:part2 + )) + +(in-package :aoc/2024/24) + + +(defun parse-line (line) + line) + + +(defun parse-input (lines) + (mapcar #'parse-line lines)) + +(defparameter input-text (test-input 2024 24)) +(defparameter input-data (parse-input input-text)) + +(defparameter sample-text (aoc:split-lines "")) +(defparameter sample-data + (parse-input sample-text)) + +(defun part1 (data) + (length data)) + +(defun part2 (data) + (length data)) + +(defun solve-day () + (format t "part1: ~A~%" (part1 input-data)) + (format t "part2: ~A~%" (part2 input-data))) + +(defun submit () + (let ((p1 (part1 input-data)) + (p2 (part2 input-data))) + (if p1 (submit-part1 2024 24 p1)) + (if p2 (submit-part2 2024 24 p2)))) diff --git a/tests/2024/day24-test.lisp b/tests/2024/day24-test.lisp new file mode 100644 index 0000000..36433d0 --- /dev/null +++ b/tests/2024/day24-test.lisp @@ -0,0 +1,27 @@ +(defpackage :aoc/2024/24/tests + (:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/24)) + +(in-package :aoc/2024/24/tests) + +(define-test suite-2024-24 + ;:parent suite-2024 + ) + +(define-test test-foo + :parent suite-2024-24 + ) + + +(define-test test-bar + :parent suite-2024-24 + ) + + + +(define-test+run test-part1 + :parent suite-2024-24 + (is equal nil (part1 sample-data))) + +(define-test+run test-part2 + :parent suite-2024-24 + (is equal nil (part2 sample-data)))