forgot cadr exists!!

day-9-common-lisp
cow 2022-12-06 02:57:58 -05:00
parent fce0ca949a
commit 9810345db9
No known key found for this signature in database
1 changed files with 4 additions and 4 deletions

View File

@ -92,8 +92,8 @@
(string-split s " " t)) (string-split s " " t))
input))) input)))
(seq-reduce (lambda (acc row) (seq-reduce (lambda (acc row)
(let* ((their-shape (cdr (assoc (nth 0 row) solution-opponent-letter-to-shape-alist))) (let* ((their-shape (cdr (assoc (car row) solution-opponent-letter-to-shape-alist)))
(our-shape (cdr (assoc (nth 1 row) solution-player-letter-to-shape-alist))) (our-shape (cdr (assoc (cadr row) solution-player-letter-to-shape-alist)))
(outcome (solution-decide-game our-shape their-shape))) (outcome (solution-decide-game our-shape their-shape)))
(+ acc (+ acc
(cdr (assoc our-shape solution-shape-score-alist)) (cdr (assoc our-shape solution-shape-score-alist))
@ -106,8 +106,8 @@
(string-split s " " t)) (string-split s " " t))
input))) input)))
(seq-reduce (lambda (acc row) (seq-reduce (lambda (acc row)
(let* ((their-shape (cdr (assoc (nth 0 row) solution-opponent-letter-to-shape-alist))) (let* ((their-shape (cdr (assoc (car row) solution-opponent-letter-to-shape-alist)))
(desired-outcome (cdr (assoc (nth 1 row) solution-player-letter-to-outcome-alist))) (desired-outcome (cdr (assoc (cadr row) solution-player-letter-to-outcome-alist)))
(our-shape (solution-shape-for-outcome their-shape desired-outcome))) (our-shape (solution-shape-for-outcome their-shape desired-outcome)))
(+ acc (+ acc
(cdr (assoc our-shape solution-shape-score-alist)) (cdr (assoc our-shape solution-shape-score-alist))