From 20fd4652042d21ed9aa61e2415e704a84129da37 Mon Sep 17 00:00:00 2001 From: 4903000 <4903000@chiru.no> Date: Sun, 6 Dec 2020 10:43:06 +0000 Subject: [PATCH] Add some comments to distinguish code from different days --- aoc20.lisp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/aoc20.lisp b/aoc20.lisp index 289e86f..50bc648 100644 --- a/aoc20.lisp +++ b/aoc20.lisp @@ -1,5 +1,7 @@ ;;;; AoC 2020 +;;; Day 1 + (defun read-1 (file) (with-open-file (stream file) (loop for line = (read-line stream nil) @@ -32,6 +34,8 @@ (print (solve-1-1 data target)) (print (solve-1-2 data target))))) +;;; Day 2 + (defstruct password (pchar) (prange) @@ -74,6 +78,8 @@ (time (progn (print (%solve-2 data #'%solve-2-1)) (print (%solve-2 data #'%solve-2-2)))))) +;;; Day 3 + (defun read-3 (file) (with-open-file (stream file) (let ((temp-map (loop for line = (read-line stream nil) @@ -116,6 +122,8 @@ (print (solve-3-1 '(1 3) data)) (print (solve-3-2 '((1 1) (1 3) (1 5) (1 7) (2 1)) data))))) +;;; Day 4 + (defvar *passport-fields* (list "byr" "iyr" "eyr" "hgt" "hcl" "ecl" "pid" "cid")) (defvar *passport-rules-broken* (list nil nil nil nil nil nil nil (lambda (n) (declare (ignore n)) t))) (defvar *passport-rules* nil) @@ -184,6 +192,8 @@ #\0 (elt bits 0) string)) :radix 2)) +;;; Day 5 + (defun read-5 (file) (with-open-file (stream file) (loop for line = (read-line stream nil) @@ -213,6 +223,8 @@ (solve-5-2 data) (print p1-answer))))) +;;; Day 6 + (defun read-forms (stream) (loop for line = (read-line stream nil) while (and line (not (string= line "")))