progress in part2

main
Jacopo De Simoi 6 months ago
parent 6dc925d565
commit 0242a39a06
  1. 15
      p21/p21.org

@ -149,7 +149,7 @@ would blow in my face since we would have too many options to check.
#+end_src #+end_src
#+RESULTS: #+RESULTS:
: 222670 : 1972
The new idea would be to run things bottom-down. For a given pair of The new idea would be to run things bottom-down. For a given pair of
@ -161,6 +161,17 @@ So we start from all possible combinations of keypad pairs
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq direction-pairs (let ((directions (advent/split-string-into-char-list "<>^vA"))) (setq direction-pairs (let ((directions (advent/split-string-into-char-list "<>^vA")))
(-mapcat (lambda (x) (--map (cons x it) directions)) directions))) (-mapcat (lambda (x) (--map (cons x it) directions)) directions)))
(setq basis-induction
(--map (cons it (connecting-paths (char-pairs-to-coordinate-pairs it dir-keypad-data) dir-keypad-data)) direction-pairs)
first-step (--map (cons (car it) (pick-shortest-string (cdr it))) basis-induction) )
(defun iterate-robot (s al)
(apply #'concat (--map (cdr (assoc it al)) (split-into-char-pairs (concat "A" s)))))
(defun iterate-step (l)
(--map (cons (car it) (pick-shortest-string
(--map (iterate-robot it l) (cdr it))))
basis-induction)
)
(--map (connecting-paths (char-pairs-to-coordinate-pairs it dir-keypad-data) dir-keypad-data) direction-pairs)
#+end_src #+end_src

Loading…
Cancel
Save