aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AoC2022/03/input300
-rw-r--r--AoC2022/03/makefile14
-rw-r--r--AoC2022/03/solver.el66
-rw-r--r--readme.org3
4 files changed, 383 insertions, 0 deletions
diff --git a/AoC2022/03/input b/AoC2022/03/input
new file mode 100644
index 0000000..039c2c5
--- /dev/null
+++ b/AoC2022/03/input
@@ -0,0 +1,300 @@
+LdHVLDLDdHdtLMhcqCqGWcWg
+ZZQZSZnnJrQrJQJbfzfnWGWPWMcChMMPcqMnhFcF
+ZrzpWzfbpQpWbzvZWZpdtVtDNmRHNVptNDHt
+gzCjffWZCtCfZZVdqVSqJdvJndSt
+hMHLcmGLMLhHmsRMsSvsQSqrsrlJTTdV
+NPNGRGHGHNLczNzzZFWSFFCC
+VSBpcvNNbNWWSfGRwtJnRtrzzGzGGn
+jZlhTlQLHFLLZbwrzQQsttDtbs
+hmmPFlhLmhLMgFMFLbMBBgcNVcfNCcfSVSSNBq
+jRDSzjCjjMRMrHzMRCDHMDjBnlQbbnQwLwrNLPwnTPQrlc
+sZBqdZqsWgFBpgppGJqllPllwnbQwTwsswQPwN
+gJgtJJBtqJqWBGzjRCHDDzRmDtVV
+GRBWbbWnGNhbwSsfPfmrlslWsS
+HLVCgCLpMgcLVDcDCgmlvstSlsstPtSSSlscvl
+LzQDQzMMzJzFQVDJgCzJHJZRZBNbqGFhNFwBGhbhBhBm
+JNsHhdPZSdZJjSHzzNwvwGgBFmBmvptJbFvm
+WrDrwqqqQWVMCvMvGbGbbFFbFp
+rqqLncqnlCncwQWCwWlLfSZPsZddfzzNNdhdPlZz
+rwfrwHqSdRcgwdZrDcrqDDdgNzjNjPzPJNJPtbNPbGsHNGHv
+hllLMTLLQMCzJssPsTvtFG
+QtQnpWVVMVWnVQpRZSSwZDggrcSq
+FDlqPMBdmbqMrdDqqFdFDwjHZChHHZfZWZNBsZjhfhHf
+VQJVgncpTQRJfsssGhsNWC
+NtpLLSpcLVRzzRRtp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0 +1,14 @@
+##
+# run solutions
+#
+# @file
+# @version 0.1
+
+
+
+# end
+
+run:
+ emacs -batch -l ert -l solver.el -f ert-run-tests-batch-and-exit
+ # sbcl --load ~/.sbclrc --script solver.lisp
+ # rustc solver.rs && ./solver
diff --git a/AoC2022/03/solver.el b/AoC2022/03/solver.el
new file mode 100644
index 0000000..d2c7c05
--- /dev/null
+++ b/AoC2022/03/solver.el
@@ -0,0 +1,66 @@
+;;; solver.el --- Day 03 -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2022 Óscar Nájera
+;;
+;; Author: Óscar Nájera <hi@oscarnajera.com>
+;; Maintainer: Óscar Nájera <hi@oscarnajera.com>
+;; Created: December 04, 2022
+;; Modified: December 04, 2022
+;;
+;; This file is not part of GNU Emacs.
+;;
+;;; Commentary:
+;;
+;; Day 03
+;;
+;;; Code:
+
+(defsubst solver-recover-value (cross)
+ (let ((result 0))
+ (while (= 0 (logand cross 1))
+ (setq cross (ash cross -1))
+ (cl-incf result))
+ result))
+
+(ert-deftest test-recover ()
+ (should (eq ?t (+ 64 (solver-recover-value (ash 1 (- ?t 64))))))
+ (should (eq ?s (+ 64 (solver-recover-value (ash 1 (- ?s 64))))))
+ (should (eq ?C (+ 64 (solver-recover-value (ash 1 (- ?C 64))))))) ;; small cap starts at a=97, but already took 64
+
+(defsubst solver-to-priority (value)
+ (if (< value 31) ;; It is a capital letter in range [1;26]
+ (+ value 26)
+ (- value 32)))
+
+(defun solver-line-priority (str)
+ (cl-assert (length> str 0))
+ (let ((mid (/ (length str) 2))
+ (left-pack 0) (right-pack 0))
+ (cl-loop for l across (substring str 0 mid)
+ for r across (substring str mid)
+ do (progn
+ (setf left-pack (logior left-pack (ash 1 (- l 64)))) ;; ASCII letters start at 65=A
+ (setf right-pack (logior right-pack(ash 1 (- r 64)))))
+ for cross = (logand left-pack right-pack)
+ when (< 0 cross)
+ return (solver-to-priority (solver-recover-value cross)))))
+
+(ert-deftest test-line-priority ()
+ (should (= 16 (solver-line-priority "vJrwpWtwJgWrhcsFMMfFFhFp")))
+ (should (= 19 (solver-line-priority "hMHLcmGLMLhHmsRMsSvsQSqrsrlJTTdV" )))
+ (should (= 20 (solver-line-priority "ttgJtRGJQctTZtZT"))))
+
+(ert-deftest test-problems ()
+ (should (= 8072
+ (with-temp-buffer
+ ;; (insert "vJrwpWtwJgWrhcsFMMfFFhFp")
+ (insert-file-contents "input")
+ (goto-char (point-min))
+ (let ((result 0))
+ (while (not (eobp))
+ (cl-incf result (solver-line-priority
+ (buffer-substring-no-properties
+ (line-beginning-position) (line-end-position))))
+ (forward-line))
+ result)))))
+
diff --git a/readme.org b/readme.org
index 72f713b..2714097 100644
--- a/readme.org
+++ b/readme.org
@@ -1 +1,4 @@
#+title: Collection of software
+
+* AoC2022 Advent of Code
+https://adventofcode.com/2022