Advent of Code '23 - day 14
Oh boy. I already anticipated part two would involve more than a single cardinal direction, and more than a single move as well. But this amount of repeats is insane. I think we're supposed to do some pattern recognition and deduce the answer by calculating the result from this pattern instead. I'll look at it later.
Input
Example
O....#.... O.OO#....# .....##... OO.#O....O .O.....O#. O.#..O.#.# ..O..#O..O .......O.. #....###.. #OO..#....
Part 1
(defun aoc23/move-rocks (row) (let ((weight 0) (counter 0)) (seq-do-indexed (lambda (c i) (cond ((= c ?O) (setq counter (1+ counter))) ((= c ?#) (dotimes (j counter) (setq weight (+ weight (- i j)))) (setq counter 0)))) row) (dotimes (j counter) (setq weight (+ weight (- (length row) j)))) weight)) (defun aoc23/rotate-map (lines) (let ((length lines) (buf '()) (out '()) (lines (reverse lines))) (dotimes (i (length (car lines))) (dolist (l lines) (setq buf (append buf (list (elt l i))))) (setq out (append out (list (concat buf)))) (setq buf '())) out)) (apply '+ (mapcar 'aoc23/move-rocks (aoc23/rotate-map (split-string input "\n" t))))