*** test
code?
| ;; ---- Day 14 ---- | |
| (def input | |
| "O....#.... | |
| O.OO#....# | |
| .....##... | |
| OO.#O....O | |
| .O.....O#. | |
| O.#..O.#.# | |
| ..O..#O..O |
| ;; ---- Part 1 ---- | |
| (def input-1 | |
| {:board | |
| "..... | |
| .F-7. | |
| .|.|. | |
| .L-J. | |
| ....." | |
| :current [1 1] |
| (ns ms) | |
| (defn board->pos-map [board] | |
| (into {} (flatten (map-indexed (fn [i line] (map-indexed (fn [j c] {[i j] c}) line)) board)))) | |
| (defn stat-pos-map->board [pos-map] | |
| (mapv #(clojure.string/join \space (map second %)) | |
| (partition-by ffirst (sort pos-map)))) | |
| (defn get-adjacents [pos-map [i j]] |
| (ns nothing.advent) | |
| ;; ---------- Day 2 ---------- | |
| (defn insert-into [original position element] | |
| (let [[before after] (split-at position original)] | |
| (vec (concat before [element] (rest after))))) | |
| (defn program-alarm | |
| ([data input] (program-alarm data 0 input)) |
| // General e2e test that click random things in a page checking the | |
| // events and state of a Re-Frame app. | |
| // | |
| // To Run | |
| // npm i puppeteer | |
| // node puppeteer-clicking-randomly.js | |
| const puppeteer = require('puppeteer'); | |
| var fs = require('fs'); |
| (ns laboratory.advent-code-2018 | |
| (:require [cljs.test :refer-macros [deftest is testing run-tests]] | |
| [clojure.set])) | |
| (declare reach-twice) | |
| (deftest advent-code-day1-part2 | |
| (do | |
| (is (= 0 (reach-twice [+1 -1]))) | |
| (is (= 10 (reach-twice [+3 +3 +4 -2 -4]))) |
*** test
code?