src/2020/days/day-03.lisp @ 2848a4548adf

2023/01 and 2022/01

Also start porting my test data to the new account, since Twitter imploded and
apparently it's impossible for a website to store a goddamn username and
password in The Year of Our Lord 2023 so everyone just outsources auth all
the time, ugh.
author Steve Losh <steve@stevelosh.com>
date Fri, 01 Dec 2023 11:05:43 -0500
parents ff7c8ed35992
children (none)
(advent:defpackage* :advent/2020/03)
(in-package :advent/2020/03)


(defun count-trees (world drow dcol)
  (destructuring-bind (rows cols) (array-dimensions world)
    (iterate (for row :from 0 :below rows :by drow)
             (for col :modulo cols :from 0 :by dcol)
             (counting (char= #\# (aref world row col))))))

(define-problem (2020 3) (data read-2d-array) (257 1744787392)
  (values (count-trees data 1 3)
          (* (count-trees data 1 1)
             (count-trees data 1 3)
             (count-trees data 1 5)
             (count-trees data 1 7)
             (count-trees data 2 1))))

#; Scratch --------------------------------------------------------------------