diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2021-07-31 11:35:39 -0600 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2021-07-31 11:35:39 -0600 |
commit | f1998c321a4eec6d75b58d84aa8610971bf21979 (patch) | |
tree | a90783eb296cc50e1c48433f241624f26b99be27 /static/src/assets/viz/2/viz | |
parent | 03a35dcc38b055f15df160bd300969e3b703d4b1 (diff) |
move static files into static sub-dir, refactor nix a bit
Diffstat (limited to 'static/src/assets/viz/2/viz')
24 files changed, 1576 insertions, 0 deletions
diff --git a/static/src/assets/viz/2/viz/core.cljs b/static/src/assets/viz/2/viz/core.cljs new file mode 100644 index 0000000..caeb386 --- /dev/null +++ b/static/src/assets/viz/2/viz/core.cljs @@ -0,0 +1,264 @@ +(ns viz.core + (:require [quil.core :as q] + [quil.middleware :as m] + [viz.forest :as forest] + [viz.grid :as grid] + [viz.ghost :as ghost] + [viz.dial :as dial] + [goog.string :as gstring] + [goog.string.format] + )) + +(defn- debug [& args] + (.log js/console (clojure.string/join " " (map str args)))) +(defn- observe [v] (debug v) v) + +(defn- positive [n] (if (> 0 n) (- n) n)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; initialization + +(defn- window-partial [k] + (int (aget js/document "documentElement" k))) + +(def window-size + (let [w (int (min 1024 (window-partial "clientWidth")))] + [w (int (min (* w 0.75) (window-partial "clientHeight")))])) + +(def window-half-size (apply vector (map #(float (/ %1 2)) window-size))) + +(defn- set-grid-size [state] + (let [h (int (* (window-size 1) + (float (/ (:grid-width state) (window-size 0)))))] + (assoc state :grid-size [(:grid-width state) h]))) + +(defn- add-ghost [state ghost-def] + (let [[forest id] (forest/add-node (:forest state) (:start-pos ghost-def)) + ghost (-> (ghost/new-ghost) + (ghost/add-active-node id) + (assoc :ghost-def ghost-def)) + ] + (assoc state + :forest forest + :ghosts (cons ghost (:ghosts state))))) + +(defn- new-state [] + (-> {:frame-rate 15 + :color-cycle-period 8 + :tail-length 7 + :frame 0 + :grid-width 45 ; from the center + :forest (forest/new-forest grid/isometric) + } + (set-grid-size) + (add-ghost {:start-pos [-10 -10] + :color-fn (fn [state] + (let [frames-per-color-cycle + (* (:color-cycle-period state) (:frame-rate state))] + (q/color + (/ (mod (:frame state) frames-per-color-cycle) + frames-per-color-cycle) + 1 1))) + }) + )) + +(defn setup [] + (q/color-mode :hsb 1 1 1) + (new-state)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; scaling and unit conversion related + +(defn- curr-second [state] + (float (/ (:frame state) (:frame-rate state)))) + +(defn- scale [grid-size xy] + (map-indexed #(* %2 (float (/ (window-half-size %1) + (grid-size %1)))) xy)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; poss-fn + +(def bounds-buffer 1) + +(defn- in-bounds? [grid-size pos] + (let [[w h] (apply vector (map #(- % bounds-buffer) grid-size))] + (every? + #(and (>= (% 1) (- (% 0))) (<= (% 1) (% 0))) + (map vector [w h] pos)))) + +(defn- dist-from-sqr [pos1 pos2] + (reduce + (map #(* % %) (map - pos1 pos2)))) + +(defn- dist-from [pos1 pos2] + (q/sqrt (dist-from-sqr pos1 pos2))) + +(defn take-adj-poss [grid-width pos adj-poss] + (let [dist-from-center (dist-from [0 0] pos) + width grid-width + dist-ratio (/ (- width dist-from-center) width) + ] + (take + (int (* (q/map-range (rand) 0 1 0.75 1) + dist-ratio + (count adj-poss))) + adj-poss))) + +(defn- mk-poss-fn [state] + (let [grid-size (:grid-size state)] + (fn [pos adj-poss] + (->> adj-poss + (filter #(in-bounds? grid-size %)) + (sort-by #(dist-from-sqr % [0 0])) + (take-adj-poss (grid-size 0) pos))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; update + +(defn- update-ghost-forest [state update-fn] + (let [[ghosts forest] + (reduce (fn [[ghosts forest] ghost] + (let [[ghost forest] (update-fn ghost forest)] + [(cons ghost ghosts) forest])) + [nil (:forest state)] + (:ghosts state))] + (assoc state :ghosts (reverse ghosts) :forest forest))) + +(defn- ghost-incr [state poss-fn] + (update-ghost-forest state #(ghost/incr %1 %2 poss-fn))) + +(defn rm-nodes [state node-ids] + (update-ghost-forest state (fn [ghost forest] + [(reduce ghost/rm-active-node ghost node-ids) + (reduce forest/remove-node forest node-ids)]))) + +(defn- maybe-remove-roots [state] + (if (>= (:tail-length state) (:frame state)) + state + (rm-nodes state (map :id (forest/roots (:forest state)))))) + +(defn- ghost-set-color [state] + (update-ghost-forest state (fn [ghost forest] + (let [color ((get-in ghost [:ghost-def :color-fn]) state)] + [(assoc ghost :color color) forest])))) + +(defn update-state [state] + (let [poss-fn (mk-poss-fn state)] + (-> state + (ghost-set-color) + (ghost-incr poss-fn) + (maybe-remove-roots) + (update-in [:frame] inc) + ))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; draw + +(defn- draw-ellipse [pos size scale-fn] ; size is [w h] + (let [scaled-pos (scale-fn pos) + scaled-size (map int (scale-fn size))] + (apply q/ellipse (concat scaled-pos scaled-size)))) + +(defn- in-line? [& nodes] + (apply = (map #(apply map - %1) + (partition 2 1 (map :pos nodes))))) + +(defn- draw-node [node active? scale-fn] + (let [pos (:pos node) + stroke (get-in node [:meta :color]) + fill (if active? stroke 0xFFFFFFFF) + ] + (q/stroke stroke) + (q/fill fill) + (draw-ellipse pos [0.30 0.30] scale-fn))) + +(defn- draw-line [node parent scale-fn] + (let [node-color (get-in node [:meta :color]) + parent-color (get-in node [:meta :color]) + color (q/lerp-color node-color parent-color 0.5) + ] + (q/stroke color) + (q/stroke-weight 1) + (apply q/line (map scale-fn (map :pos (list parent node)))))) + +(defn- draw-lines [forest parent node scale-fn] + "Draws the lines of all children leading from the node, recursively" + (let [children (map #(forest/get-node forest %) (:child-ids node))] + + (if-not parent + (doseq [child children] (draw-lines forest node child scale-fn)) + (let [in-line-child (some #(if (in-line? parent node %) %) children) + ] + (doseq [child children] + (if (and in-line-child (= in-line-child child)) + (draw-lines forest parent child scale-fn) + (draw-lines forest node child scale-fn))) + (when-not in-line-child + (draw-line node parent scale-fn)) + )) + + ; we also take the opportunity to draw the leaves + (when (empty? children) + (draw-node node false scale-fn)) + )) + +(defn draw-dial [state dial posL posR] + (let [dial-norm (q/norm (:val dial) (:min dial) (:max dial)) + dial-pos (map #(q/lerp %1 %2 dial-norm) posL posR)] + (q/stroke 0xFF000000) + (q/stroke-weight 1) + (q/fill 0xFF000000) + (apply q/line (concat posL posR)) + (apply q/ellipse (concat dial-pos [5 5])) + )) + +(defn draw-state [state] + ; Clear the sketch by filling it with light-grey color. + (q/background 0xFFFFFFFF) + (q/with-translation window-half-size + + (let [grid-size (:grid-size state) + scale-fn #(scale grid-size %) + ghost (:ghost state) + forest (:forest state) + roots (forest/roots forest) + ] + + (doseq [root roots] + (draw-lines forest nil root scale-fn)) + + (doseq [ghost (:ghosts state)] + (doseq [active-node (map #(forest/get-node forest %) + (:active-node-ids ghost))] + (draw-node active-node true scale-fn))) + + )) + + ;(draw-dial state (:dial state) [30 30] [100 30]) + + ;(q/text (clojure.string/join + ; "\n" + ; (list + ; (gstring/format "frame:%d" (:frame state)) + ; (gstring/format "second:%f" (curr-second state)) + ; (gstring/format "spawn-chance:%d" (spawn-chance state)))) + ; 30 30) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; def + +(q/defsketch viz + :title "" + :host "viz" + :size window-size + ; setup function called only once, during sketch initialization. + :setup setup + ; update-state is called on each iteration before draw-state. + :update update-state + :draw draw-state + :features [:keep-on-top] + ; This sketch uses functional-mode middleware. + ; Check quil wiki for more info about middlewares and particularly + ; fun-mode. + :middleware [m/fun-mode]) diff --git a/static/src/assets/viz/2/viz/core.cljs.cache.json b/static/src/assets/viz/2/viz/core.cljs.cache.json new file mode 100644 index 0000000..ade1293 --- /dev/null +++ b/static/src/assets/viz/2/viz/core.cljs.cache.json @@ -0,0 +1 @@ +["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:externs",["^ ","~$console",["^ ","~$log",["^ "]],"~$document",["^ "]],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$viz.core","~:imports",null,"~:requires",["^ ","~$gstring","~$goog.string","^>","^>","~$q","~$quil.core","~$viz.forest","^@","~$grid","~$viz.grid","~$m","~$quil.middleware","^?","^?","^C","^C","~$goog.string.format","^D","~$viz.ghost","^E","~$forest","^@","^B","^B","~$ghost","^E","~$viz.dial","^H","~$dial","^H"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$rm-nodes",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/home/mediocregopher/src/viz/src/viz/core.cljs","~:line",130,"~:column",7,"~:end-line",130,"~:end-column",15,"~:arglists",["~#list",["~$quote",["^V",[["~$state","~$node-ids"]]]]]],"^9","~$viz.core/rm-nodes","^P","src/viz/core.cljs","^T",15,"~:method-params",["^V",[["^X","^Y"]]],"~:protocol-impl",null,"~:arglists-meta",["^V",[null,null]],"^R",1,"~:variadic?",false,"^Q",130,"~:ret-tag","~$any","^S",130,"~:max-fixed-arity",2,"~:fn-var",true,"^U",["^V",["^W",["^V",[["^X","^Y"]]]]]],"~$maybe-remove-roots",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",135,"^R",8,"^S",135,"^T",26,"~:private",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"^18",true,"^9","~$viz.core/maybe-remove-roots","^P","src/viz/core.cljs","^T",26,"^[",["^V",[["^X"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",135,"^13",["^8",[null,"^14"]],"^S",135,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"~$draw-node",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",166,"^R",8,"^S",166,"^T",17,"^18",true,"^U",["^V",["^W",["^V",[["~$node","~$active?","~$scale-fn"]]]]]],"^18",true,"^9","~$viz.core/draw-node","^P","src/viz/core.cljs","^T",17,"^[",["^V",[["^1;","^1<","^1="]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",166,"^13","^14","^S",166,"^15",3,"^16",true,"^U",["^V",["^W",["^V",[["^1;","^1<","^1="]]]]]],"~$draw-state",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",215,"^R",7,"^S",215,"^T",17,"^U",["^V",["^W",["^V",[["^X"]]]]]],"^9","~$viz.core/draw-state","^P","src/viz/core.cljs","^T",17,"^[",["^V",[["^X"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",215,"^S",215,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"~$viz",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",251,"^R",14,"^S",251,"^T",17,"~:export",true,"^U",["^V",["^W",["^V",[[]]]]]],"^9","~$viz.core/viz","^P","src/viz/core.cljs","^T",17,"^[",["^V",[[]]],"^10",null,"^1B",true,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",251,"^13","^14","^S",251,"^15",0,"^16",true,"^U",["^V",["^W",["^V",[[]]]]]],"~$update-state",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",145,"^R",7,"^S",145,"^T",19,"^U",["^V",["^W",["^V",[["^X"]]]]]],"^9","~$viz.core/update-state","^P","src/viz/core.cljs","^T",19,"^[",["^V",[["^X"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",145,"^13","^14","^S",145,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"~$draw-ellipse",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",157,"^R",8,"^S",157,"^T",20,"^18",true,"^U",["^V",["^W",["^V",[["~$pos","~$size","^1="]]]]]],"^18",true,"^9","~$viz.core/draw-ellipse","^P","src/viz/core.cljs","^T",20,"^[",["^V",[["^1G","^1H","^1="]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",157,"^13","^14","^S",157,"^15",3,"^16",true,"^U",["^V",["^W",["^V",[["^1G","^1H","^1="]]]]]],"~$window-partial",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",21,"^R",8,"^S",21,"^T",22,"^18",true,"^U",["^V",["^W",["^V",[["~$k"]]]]]],"^18",true,"^9","~$viz.core/window-partial","^P","src/viz/core.cljs","^T",22,"^[",["^V",[["~$k"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",21,"^13","~$number","^S",21,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["~$k"]]]]]],"~$mk-poss-fn",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",107,"^R",8,"^S",107,"^T",18,"^18",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"^18",true,"^9","~$viz.core/mk-poss-fn","^P","src/viz/core.cljs","^T",18,"^[",["^V",[["^X"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",107,"^13","~$function","^S",107,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"~$update-ghost-forest",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",118,"^R",8,"^S",118,"^T",27,"^18",true,"^U",["^V",["^W",["^V",[["^X","~$update-fn"]]]]]],"^18",true,"^9","~$viz.core/update-ghost-forest","^P","src/viz/core.cljs","^T",27,"^[",["^V",[["^X","^1Q"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",118,"^13","^14","^S",118,"^15",2,"^16",true,"^U",["^V",["^W",["^V",[["^X","^1Q"]]]]]],"~$new-state",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",45,"^R",8,"^S",45,"^T",17,"^18",true,"^U",["^V",["^W",["^V",[[]]]]]],"^18",true,"^9","~$viz.core/new-state","^P","src/viz/core.cljs","^T",17,"^[",["^V",[[]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",45,"^13","^14","^S",45,"^15",0,"^16",true,"^U",["^V",["^W",["^V",[[]]]]]],"~$dist-from",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",93,"^R",8,"^S",93,"^T",17,"^18",true,"^U",["^V",["^W",["^V",[["~$pos1","~$pos2"]]]]]],"^18",true,"^9","~$viz.core/dist-from","^P","src/viz/core.cljs","^T",17,"^[",["^V",[["^1V","^1W"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",93,"^13","^14","^S",93,"^15",2,"^16",true,"^U",["^V",["^W",["^V",[["^1V","^1W"]]]]]],"~$observe",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",14,"^R",8,"^S",14,"^T",15,"^18",true,"^U",["^V",["^W",["^V",[["~$v"]]]]]],"^18",true,"^9","~$viz.core/observe","^P","src/viz/core.cljs","^T",15,"^[",["^V",[["~$v"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",14,"^S",14,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["~$v"]]]]]],"~$window-half-size",["^ ","^9","~$viz.core/window-half-size","^P","src/viz/core.cljs","^Q",28,"^R",1,"^S",28,"^T",22,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",28,"^R",6,"^S",28,"^T",22],"~:tag","^14"],"~$window-size",["^ ","^9","~$viz.core/window-size","^P","src/viz/core.cljs","^Q",24,"^R",1,"^S",24,"^T",17,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",24,"^R",6,"^S",24,"^T",17],"^21","~$cljs.core/IVector"],"~$scale",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",75,"^R",8,"^S",75,"^T",13,"^18",true,"^U",["^V",["^W",["^V",[["~$grid-size","~$xy"]]]]]],"^18",true,"^9","~$viz.core/scale","^P","src/viz/core.cljs","^T",13,"^[",["^V",[["^26","^27"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",75,"^13","^14","^S",75,"^15",2,"^16",true,"^U",["^V",["^W",["^V",[["^26","^27"]]]]]],"~$in-line?",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",162,"^R",8,"^S",162,"^T",16,"^18",true,"^U",["^V",["^W",["^V",[["~$&","~$nodes"]]]]],"~:top-fn",["^ ","^12",true,"^15",0,"^[",[["^V",["^2:"]]],"^U",["^V",[["~$&","^2:"]]],"^11",["^V",[null]]]],"^18",true,"^9","~$viz.core/in-line?","^P","src/viz/core.cljs","^T",16,"^2;",["^ ","^12",true,"^15",0,"^[",[["^V",["^2:"]]],"^U",["^V",[["~$&","^2:"]]],"^11",["^V",[null]]],"^[",[["^V",["^2:"]]],"^10",null,"^11",["^V",[null]],"^R",1,"^12",true,"^Q",162,"^13","^14","^S",162,"^15",0,"^16",true,"^U",["^V",[["~$&","^2:"]]]],"~$take-adj-poss",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",96,"^R",7,"^S",96,"^T",20,"^U",["^V",["^W",["^V",[["~$grid-width","^1G","~$adj-poss"]]]]]],"^9","~$viz.core/take-adj-poss","^P","src/viz/core.cljs","^T",20,"^[",["^V",[["^2>","^1G","^2?"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",96,"^13","^14","^S",96,"^15",3,"^16",true,"^U",["^V",["^W",["^V",[["^2>","^1G","^2?"]]]]]],"~$positive",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",16,"^R",8,"^S",16,"^T",16,"^18",true,"^U",["^V",["^W",["^V",[["~$n"]]]]]],"^18",true,"^9","~$viz.core/positive","^P","src/viz/core.cljs","^T",16,"^[",["^V",[["~$n"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",16,"^13",["^8",[null,"^1L"]],"^S",16,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["~$n"]]]]]],"~$debug",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",12,"^R",8,"^S",12,"^T",13,"^18",true,"^U",["^V",["^W",["^V",[["~$&","~$args"]]]]],"^2;",["^ ","^12",true,"^15",0,"^[",[["^V",["^2D"]]],"^U",["^V",[["~$&","^2D"]]],"^11",["^V",[null]]]],"^18",true,"^9","~$viz.core/debug","^P","src/viz/core.cljs","^T",13,"^2;",["^ ","^12",true,"^15",0,"^[",[["^V",["^2D"]]],"^U",["^V",[["~$&","^2D"]]],"^11",["^V",[null]]],"^[",[["^V",["^2D"]]],"^10",null,"^11",["^V",[null]],"^R",1,"^12",true,"^Q",12,"^13","^14","^S",12,"^15",0,"^16",true,"^U",["^V",[["~$&","^2D"]]]],"~$add-ghost",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",35,"^R",8,"^S",35,"^T",17,"^18",true,"^U",["^V",["^W",["^V",[["^X","~$ghost-def"]]]]]],"^18",true,"^9","~$viz.core/add-ghost","^P","src/viz/core.cljs","^T",17,"^[",["^V",[["^X","^2G"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",35,"^13","^14","^S",35,"^15",2,"^16",true,"^U",["^V",["^W",["^V",[["^X","^2G"]]]]]],"~$dist-from-sqr",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",90,"^R",8,"^S",90,"^T",21,"^18",true,"^U",["^V",["^W",["^V",[["^1V","^1W"]]]]]],"^18",true,"^9","~$viz.core/dist-from-sqr","^P","src/viz/core.cljs","^T",21,"^[",["^V",[["^1V","^1W"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",90,"^13","^14","^S",90,"^15",2,"^16",true,"^U",["^V",["^W",["^V",[["^1V","^1W"]]]]]],"~$setup",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",65,"^R",7,"^S",65,"^T",12,"^U",["^V",["^W",["^V",[[]]]]]],"^9","~$viz.core/setup","^P","src/viz/core.cljs","^T",12,"^[",["^V",[[]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",65,"^13","^14","^S",65,"^15",0,"^16",true,"^U",["^V",["^W",["^V",[[]]]]]],"~$set-grid-size",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",30,"^R",8,"^S",30,"^T",21,"^18",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"^18",true,"^9","~$viz.core/set-grid-size","^P","src/viz/core.cljs","^T",21,"^[",["^V",[["^X"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",30,"^13","^14","^S",30,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"~$draw-dial",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",205,"^R",7,"^S",205,"^T",16,"^U",["^V",["^W",["^V",[["^X","^I","~$posL","~$posR"]]]]]],"^9","~$viz.core/draw-dial","^P","src/viz/core.cljs","^T",16,"^[",["^V",[["^X","^I","^2P","^2Q"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",205,"^13","^14","^S",205,"^15",4,"^16",true,"^U",["^V",["^W",["^V",[["^X","^I","^2P","^2Q"]]]]]],"~$in-bounds?",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",84,"^R",8,"^S",84,"^T",18,"^18",true,"^U",["^V",["^W",["^V",[["^26","^1G"]]]]]],"^18",true,"^9","~$viz.core/in-bounds?","^P","src/viz/core.cljs","^T",18,"^[",["^V",[["^26","^1G"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",84,"^13","~$boolean","^S",84,"^15",2,"^16",true,"^U",["^V",["^W",["^V",[["^26","^1G"]]]]]],"~$draw-lines",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",184,"^R",8,"^S",184,"^T",18,"^18",true,"^U",["^V",["^W",["^V",[["^F","~$parent","^1;","^1="]]]]]],"^18",true,"^9","~$viz.core/draw-lines","^P","src/viz/core.cljs","^T",18,"^[",["^V",[["^F","^2W","^1;","^1="]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",184,"^13",["^8",["^14","~$clj-nil"]],"^S",184,"^15",4,"^16",true,"^U",["^V",["^W",["^V",[["^F","^2W","^1;","^1="]]]]]],"~$ghost-incr",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",127,"^R",8,"^S",127,"^T",18,"^18",true,"^U",["^V",["^W",["^V",[["^X","~$poss-fn"]]]]]],"^18",true,"^9","~$viz.core/ghost-incr","^P","src/viz/core.cljs","^T",18,"^[",["^V",[["^X","^2["]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",127,"^13","^14","^S",127,"^15",2,"^16",true,"^U",["^V",["^W",["^V",[["^X","^2["]]]]]],"~$draw-line",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",175,"^R",8,"^S",175,"^T",17,"^18",true,"^U",["^V",["^W",["^V",[["^1;","^2W","^1="]]]]]],"^18",true,"^9","~$viz.core/draw-line","^P","src/viz/core.cljs","^T",17,"^[",["^V",[["^1;","^2W","^1="]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",175,"^13","^14","^S",175,"^15",3,"^16",true,"^U",["^V",["^W",["^V",[["^1;","^2W","^1="]]]]]],"~$ghost-set-color",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",140,"^R",8,"^S",140,"^T",23,"^18",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"^18",true,"^9","~$viz.core/ghost-set-color","^P","src/viz/core.cljs","^T",23,"^[",["^V",[["^X"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",140,"^13","^14","^S",140,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"~$bounds-buffer",["^ ","^9","~$viz.core/bounds-buffer","^P","src/viz/core.cljs","^Q",82,"^R",1,"^S",82,"^T",19,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",82,"^R",6,"^S",82,"^T",19],"^21","^1L"],"~$curr-second",["^ ","^N",null,"^O",["^ ","^P","/home/mediocregopher/src/viz/src/viz/core.cljs","^Q",72,"^R",8,"^S",72,"^T",19,"^18",true,"^U",["^V",["^W",["^V",[["^X"]]]]]],"^18",true,"^9","~$viz.core/curr-second","^P","src/viz/core.cljs","^T",19,"^[",["^V",[["^X"]]],"^10",null,"^11",["^V",[null,null]],"^R",1,"^12",false,"^Q",72,"^13","^1L","^S",72,"^15",1,"^16",true,"^U",["^V",["^W",["^V",[["^X"]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^8",["~:features","~:active-node-ids","~:hsb","~:min","~:grid-width","~:frame-rate","~:color-cycle-period","~:fn","^O","~:frame","~:color","~:ghost-def","~:pos","~:val","~:update","~:size","~:title","~:tail-length","~:setup","~:middleware","~:grid-size","~:host","~:forest","~:max","~:id","~:keep-on-top","~:host-id","~:no-start","~:ghost","~:color-fn","~:draw","~:child-ids","~:ghosts","~:start-pos"]],"~:order",["^3A","^3P","^3R","^41","^3G","^40","^3B","^3C","^3M","^3E","^3Y","^3?","^3T","^3F","^3H","^O","^3[","^3I","^3@","^3S","^3X","^3>","^3Q","^3=","^3U","^3J","^3K","^3L","^3N","^3O","^3Z","^3W","^3D","^3V"]],"~:doc",null]
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/core.js b/static/src/assets/viz/2/viz/core.js new file mode 100644 index 0000000..a14b2fd --- /dev/null +++ b/static/src/assets/viz/2/viz/core.js @@ -0,0 +1,753 @@ +// Compiled by ClojureScript 1.10.439 {} +goog.provide('viz.core'); +goog.require('cljs.core'); +goog.require('quil.core'); +goog.require('quil.middleware'); +goog.require('viz.forest'); +goog.require('viz.grid'); +goog.require('viz.ghost'); +goog.require('viz.dial'); +goog.require('goog.string'); +goog.require('goog.string.format'); +viz.core.debug = (function viz$core$debug(var_args){ +var args__4647__auto__ = []; +var len__4641__auto___25578 = arguments.length; +var i__4642__auto___25579 = (0); +while(true){ +if((i__4642__auto___25579 < len__4641__auto___25578)){ +args__4647__auto__.push((arguments[i__4642__auto___25579])); + +var G__25580 = (i__4642__auto___25579 + (1)); +i__4642__auto___25579 = G__25580; +continue; +} else { +} +break; +} + +var argseq__4648__auto__ = ((((0) < args__4647__auto__.length))?(new cljs.core.IndexedSeq(args__4647__auto__.slice((0)),(0),null)):null); +return viz.core.debug.cljs$core$IFn$_invoke$arity$variadic(argseq__4648__auto__); +}); + +viz.core.debug.cljs$core$IFn$_invoke$arity$variadic = (function (args){ +return console.log(clojure.string.join.call(null," ",cljs.core.map.call(null,cljs.core.str,args))); +}); + +viz.core.debug.cljs$lang$maxFixedArity = (0); + +/** @this {Function} */ +viz.core.debug.cljs$lang$applyTo = (function (seq25577){ +var self__4629__auto__ = this; +return self__4629__auto__.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq25577)); +}); + +viz.core.observe = (function viz$core$observe(v){ +viz.core.debug.call(null,v); + +return v; +}); +viz.core.positive = (function viz$core$positive(n){ +if(((0) > n)){ +return (- n); +} else { +return n; +} +}); +viz.core.window_partial = (function viz$core$window_partial(k){ +return ((document["documentElement"][k]) | (0)); +}); +viz.core.window_size = (function (){var w = ((function (){var x__4138__auto__ = (1024); +var y__4139__auto__ = viz.core.window_partial.call(null,"clientWidth"); +return ((x__4138__auto__ < y__4139__auto__) ? x__4138__auto__ : y__4139__auto__); +})() | (0)); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [w,((function (){var x__4138__auto__ = (w * 0.75); +var y__4139__auto__ = viz.core.window_partial.call(null,"clientHeight"); +return ((x__4138__auto__ < y__4139__auto__) ? x__4138__auto__ : y__4139__auto__); +})() | (0))], null); +})(); +viz.core.window_half_size = cljs.core.apply.call(null,cljs.core.vector,cljs.core.map.call(null,(function (p1__25581_SHARP_){ +return (p1__25581_SHARP_ / (2)); +}),viz.core.window_size)); +viz.core.set_grid_size = (function viz$core$set_grid_size(state){ +var h = ((viz.core.window_size.call(null,(1)) * (new cljs.core.Keyword(null,"grid-width","grid-width",837583106).cljs$core$IFn$_invoke$arity$1(state) / viz.core.window_size.call(null,(0)))) | (0)); +return cljs.core.assoc.call(null,state,new cljs.core.Keyword(null,"grid-size","grid-size",2138480144),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"grid-width","grid-width",837583106).cljs$core$IFn$_invoke$arity$1(state),h], null)); +}); +viz.core.add_ghost = (function viz$core$add_ghost(state,ghost_def){ +var vec__25582 = viz.forest.add_node.call(null,new cljs.core.Keyword(null,"forest","forest",278860306).cljs$core$IFn$_invoke$arity$1(state),new cljs.core.Keyword(null,"start-pos","start-pos",668789086).cljs$core$IFn$_invoke$arity$1(ghost_def)); +var forest = cljs.core.nth.call(null,vec__25582,(0),null); +var id = cljs.core.nth.call(null,vec__25582,(1),null); +var ghost = cljs.core.assoc.call(null,viz.ghost.add_active_node.call(null,viz.ghost.new_ghost.call(null),id),new cljs.core.Keyword(null,"ghost-def","ghost-def",1211539367),ghost_def); +return cljs.core.assoc.call(null,state,new cljs.core.Keyword(null,"forest","forest",278860306),forest,new cljs.core.Keyword(null,"ghosts","ghosts",665819293),cljs.core.cons.call(null,ghost,new cljs.core.Keyword(null,"ghosts","ghosts",665819293).cljs$core$IFn$_invoke$arity$1(state))); +}); +viz.core.new_state = (function viz$core$new_state(){ +return viz.core.add_ghost.call(null,viz.core.set_grid_size.call(null,new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"frame-rate","frame-rate",-994918942),(15),new cljs.core.Keyword(null,"color-cycle-period","color-cycle-period",1656886882),(8),new cljs.core.Keyword(null,"tail-length","tail-length",-2007115089),(7),new cljs.core.Keyword(null,"frame","frame",-1711082588),(0),new cljs.core.Keyword(null,"grid-width","grid-width",837583106),(45),new cljs.core.Keyword(null,"forest","forest",278860306),viz.forest.new_forest.call(null,viz.grid.isometric)], null)),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"start-pos","start-pos",668789086),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(-10),(-10)], null),new cljs.core.Keyword(null,"color-fn","color-fn",1518098073),(function (state){ +var frames_per_color_cycle = (new cljs.core.Keyword(null,"color-cycle-period","color-cycle-period",1656886882).cljs$core$IFn$_invoke$arity$1(state) * new cljs.core.Keyword(null,"frame-rate","frame-rate",-994918942).cljs$core$IFn$_invoke$arity$1(state)); +return quil.core.color.call(null,(cljs.core.mod.call(null,new cljs.core.Keyword(null,"frame","frame",-1711082588).cljs$core$IFn$_invoke$arity$1(state),frames_per_color_cycle) / frames_per_color_cycle),(1),(1)); +})], null)); +}); +viz.core.setup = (function viz$core$setup(){ +quil.core.color_mode.call(null,new cljs.core.Keyword(null,"hsb","hsb",-753472031),(1),(1),(1)); + +return viz.core.new_state.call(null); +}); +viz.core.curr_second = (function viz$core$curr_second(state){ +return (new cljs.core.Keyword(null,"frame","frame",-1711082588).cljs$core$IFn$_invoke$arity$1(state) / new cljs.core.Keyword(null,"frame-rate","frame-rate",-994918942).cljs$core$IFn$_invoke$arity$1(state)); +}); +viz.core.scale = (function viz$core$scale(grid_size,xy){ +return cljs.core.map_indexed.call(null,(function (p1__25586_SHARP_,p2__25585_SHARP_){ +return (p2__25585_SHARP_ * (viz.core.window_half_size.call(null,p1__25586_SHARP_) / grid_size.call(null,p1__25586_SHARP_))); +}),xy); +}); +viz.core.bounds_buffer = (1); +viz.core.in_bounds_QMARK_ = (function viz$core$in_bounds_QMARK_(grid_size,pos){ +var vec__25589 = cljs.core.apply.call(null,cljs.core.vector,cljs.core.map.call(null,(function (p1__25587_SHARP_){ +return (p1__25587_SHARP_ - viz.core.bounds_buffer); +}),grid_size)); +var w = cljs.core.nth.call(null,vec__25589,(0),null); +var h = cljs.core.nth.call(null,vec__25589,(1),null); +return cljs.core.every_QMARK_.call(null,((function (vec__25589,w,h){ +return (function (p1__25588_SHARP_){ +return (((p1__25588_SHARP_.call(null,(1)) >= (- p1__25588_SHARP_.call(null,(0))))) && ((p1__25588_SHARP_.call(null,(1)) <= p1__25588_SHARP_.call(null,(0))))); +});})(vec__25589,w,h)) +,cljs.core.map.call(null,cljs.core.vector,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [w,h], null),pos)); +}); +viz.core.dist_from_sqr = (function viz$core$dist_from_sqr(pos1,pos2){ +return cljs.core.reduce.call(null,cljs.core._PLUS_,cljs.core.map.call(null,(function (p1__25592_SHARP_){ +return (p1__25592_SHARP_ * p1__25592_SHARP_); +}),cljs.core.map.call(null,cljs.core._,pos1,pos2))); +}); +viz.core.dist_from = (function viz$core$dist_from(pos1,pos2){ +return quil.core.sqrt.call(null,viz.core.dist_from_sqr.call(null,pos1,pos2)); +}); +viz.core.take_adj_poss = (function viz$core$take_adj_poss(grid_width,pos,adj_poss){ +var dist_from_center = viz.core.dist_from.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(0)], null),pos); +var width = grid_width; +var dist_ratio = ((width - dist_from_center) / width); +return cljs.core.take.call(null,(((quil.core.map_range.call(null,cljs.core.rand.call(null),(0),(1),0.75,(1)) * dist_ratio) * cljs.core.count.call(null,adj_poss)) | (0)),adj_poss); +}); +viz.core.mk_poss_fn = (function viz$core$mk_poss_fn(state){ +var grid_size = new cljs.core.Keyword(null,"grid-size","grid-size",2138480144).cljs$core$IFn$_invoke$arity$1(state); +return ((function (grid_size){ +return (function (pos,adj_poss){ +return viz.core.take_adj_poss.call(null,grid_size.call(null,(0)),pos,cljs.core.sort_by.call(null,((function (grid_size){ +return (function (p1__25594_SHARP_){ +return viz.core.dist_from_sqr.call(null,p1__25594_SHARP_,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(0)], null)); +});})(grid_size)) +,cljs.core.filter.call(null,((function (grid_size){ +return (function (p1__25593_SHARP_){ +return viz.core.in_bounds_QMARK_.call(null,grid_size,p1__25593_SHARP_); +});})(grid_size)) +,adj_poss))); +}); +;})(grid_size)) +}); +viz.core.update_ghost_forest = (function viz$core$update_ghost_forest(state,update_fn){ +var vec__25595 = cljs.core.reduce.call(null,(function (p__25598,ghost){ +var vec__25599 = p__25598; +var ghosts = cljs.core.nth.call(null,vec__25599,(0),null); +var forest = cljs.core.nth.call(null,vec__25599,(1),null); +var vec__25602 = update_fn.call(null,ghost,forest); +var ghost__$1 = cljs.core.nth.call(null,vec__25602,(0),null); +var forest__$1 = cljs.core.nth.call(null,vec__25602,(1),null); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cons.call(null,ghost__$1,ghosts),forest__$1], null); +}),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,new cljs.core.Keyword(null,"forest","forest",278860306).cljs$core$IFn$_invoke$arity$1(state)], null),new cljs.core.Keyword(null,"ghosts","ghosts",665819293).cljs$core$IFn$_invoke$arity$1(state)); +var ghosts = cljs.core.nth.call(null,vec__25595,(0),null); +var forest = cljs.core.nth.call(null,vec__25595,(1),null); +return cljs.core.assoc.call(null,state,new cljs.core.Keyword(null,"ghosts","ghosts",665819293),cljs.core.reverse.call(null,ghosts),new cljs.core.Keyword(null,"forest","forest",278860306),forest); +}); +viz.core.ghost_incr = (function viz$core$ghost_incr(state,poss_fn){ +return viz.core.update_ghost_forest.call(null,state,(function (p1__25605_SHARP_,p2__25606_SHARP_){ +return viz.ghost.incr.call(null,p1__25605_SHARP_,p2__25606_SHARP_,poss_fn); +})); +}); +viz.core.rm_nodes = (function viz$core$rm_nodes(state,node_ids){ +return viz.core.update_ghost_forest.call(null,state,(function (ghost,forest){ +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.reduce.call(null,viz.ghost.rm_active_node,ghost,node_ids),cljs.core.reduce.call(null,viz.forest.remove_node,forest,node_ids)], null); +})); +}); +viz.core.maybe_remove_roots = (function viz$core$maybe_remove_roots(state){ +if((new cljs.core.Keyword(null,"tail-length","tail-length",-2007115089).cljs$core$IFn$_invoke$arity$1(state) >= new cljs.core.Keyword(null,"frame","frame",-1711082588).cljs$core$IFn$_invoke$arity$1(state))){ +return state; +} else { +return viz.core.rm_nodes.call(null,state,cljs.core.map.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),viz.forest.roots.call(null,new cljs.core.Keyword(null,"forest","forest",278860306).cljs$core$IFn$_invoke$arity$1(state)))); +} +}); +viz.core.ghost_set_color = (function viz$core$ghost_set_color(state){ +return viz.core.update_ghost_forest.call(null,state,(function (ghost,forest){ +var color = cljs.core.get_in.call(null,ghost,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"ghost-def","ghost-def",1211539367),new cljs.core.Keyword(null,"color-fn","color-fn",1518098073)], null)).call(null,state); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.assoc.call(null,ghost,new cljs.core.Keyword(null,"color","color",1011675173),color),forest], null); +})); +}); +viz.core.update_state = (function viz$core$update_state(state){ +var poss_fn = viz.core.mk_poss_fn.call(null,state); +return cljs.core.update_in.call(null,viz.core.maybe_remove_roots.call(null,viz.core.ghost_incr.call(null,viz.core.ghost_set_color.call(null,state),poss_fn)),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"frame","frame",-1711082588)], null),cljs.core.inc); +}); +viz.core.draw_ellipse = (function viz$core$draw_ellipse(pos,size,scale_fn){ +var scaled_pos = scale_fn.call(null,pos); +var scaled_size = cljs.core.map.call(null,cljs.core.int$,scale_fn.call(null,size)); +return cljs.core.apply.call(null,quil.core.ellipse,cljs.core.concat.call(null,scaled_pos,scaled_size)); +}); +viz.core.in_line_QMARK_ = (function viz$core$in_line_QMARK_(var_args){ +var args__4647__auto__ = []; +var len__4641__auto___25609 = arguments.length; +var i__4642__auto___25610 = (0); +while(true){ +if((i__4642__auto___25610 < len__4641__auto___25609)){ +args__4647__auto__.push((arguments[i__4642__auto___25610])); + +var G__25611 = (i__4642__auto___25610 + (1)); +i__4642__auto___25610 = G__25611; +continue; +} else { +} +break; +} + +var argseq__4648__auto__ = ((((0) < args__4647__auto__.length))?(new cljs.core.IndexedSeq(args__4647__auto__.slice((0)),(0),null)):null); +return viz.core.in_line_QMARK_.cljs$core$IFn$_invoke$arity$variadic(argseq__4648__auto__); +}); + +viz.core.in_line_QMARK_.cljs$core$IFn$_invoke$arity$variadic = (function (nodes){ +return cljs.core.apply.call(null,cljs.core._EQ_,cljs.core.map.call(null,(function (p1__25607_SHARP_){ +return cljs.core.apply.call(null,cljs.core.map,cljs.core._,p1__25607_SHARP_); +}),cljs.core.partition.call(null,(2),(1),cljs.core.map.call(null,new cljs.core.Keyword(null,"pos","pos",-864607220),nodes)))); +}); + +viz.core.in_line_QMARK_.cljs$lang$maxFixedArity = (0); + +/** @this {Function} */ +viz.core.in_line_QMARK_.cljs$lang$applyTo = (function (seq25608){ +var self__4629__auto__ = this; +return self__4629__auto__.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq25608)); +}); + +viz.core.draw_node = (function viz$core$draw_node(node,active_QMARK_,scale_fn){ +var pos = new cljs.core.Keyword(null,"pos","pos",-864607220).cljs$core$IFn$_invoke$arity$1(node); +var stroke = cljs.core.get_in.call(null,node,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"meta","meta",1499536964),new cljs.core.Keyword(null,"color","color",1011675173)], null)); +var fill = (cljs.core.truth_(active_QMARK_)?stroke:(4294967295)); +quil.core.stroke.call(null,stroke); + +quil.core.fill.call(null,fill); + +return viz.core.draw_ellipse.call(null,pos,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [0.3,0.3], null),scale_fn); +}); +viz.core.draw_line = (function viz$core$draw_line(node,parent,scale_fn){ +var node_color = cljs.core.get_in.call(null,node,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"meta","meta",1499536964),new cljs.core.Keyword(null,"color","color",1011675173)], null)); +var parent_color = cljs.core.get_in.call(null,node,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"meta","meta",1499536964),new cljs.core.Keyword(null,"color","color",1011675173)], null)); +var color = quil.core.lerp_color.call(null,node_color,parent_color,0.5); +quil.core.stroke.call(null,color); + +quil.core.stroke_weight.call(null,(1)); + +return cljs.core.apply.call(null,quil.core.line,cljs.core.map.call(null,scale_fn,cljs.core.map.call(null,new cljs.core.Keyword(null,"pos","pos",-864607220),(new cljs.core.List(null,parent,(new cljs.core.List(null,node,null,(1),null)),(2),null))))); +}); +viz.core.draw_lines = (function viz$core$draw_lines(forest,parent,node,scale_fn){ + +var children = cljs.core.map.call(null,(function (p1__25612_SHARP_){ +return viz.forest.get_node.call(null,forest,p1__25612_SHARP_); +}),new cljs.core.Keyword(null,"child-ids","child-ids",-604525861).cljs$core$IFn$_invoke$arity$1(node)); +if(cljs.core.not.call(null,parent)){ +var seq__25614_25622 = cljs.core.seq.call(null,children); +var chunk__25615_25623 = null; +var count__25616_25624 = (0); +var i__25617_25625 = (0); +while(true){ +if((i__25617_25625 < count__25616_25624)){ +var child_25626 = cljs.core._nth.call(null,chunk__25615_25623,i__25617_25625); +viz.core.draw_lines.call(null,forest,node,child_25626,scale_fn); + + +var G__25627 = seq__25614_25622; +var G__25628 = chunk__25615_25623; +var G__25629 = count__25616_25624; +var G__25630 = (i__25617_25625 + (1)); +seq__25614_25622 = G__25627; +chunk__25615_25623 = G__25628; +count__25616_25624 = G__25629; +i__25617_25625 = G__25630; +continue; +} else { +var temp__4657__auto___25631 = cljs.core.seq.call(null,seq__25614_25622); +if(temp__4657__auto___25631){ +var seq__25614_25632__$1 = temp__4657__auto___25631; +if(cljs.core.chunked_seq_QMARK_.call(null,seq__25614_25632__$1)){ +var c__4461__auto___25633 = cljs.core.chunk_first.call(null,seq__25614_25632__$1); +var G__25634 = cljs.core.chunk_rest.call(null,seq__25614_25632__$1); +var G__25635 = c__4461__auto___25633; +var G__25636 = cljs.core.count.call(null,c__4461__auto___25633); +var G__25637 = (0); +seq__25614_25622 = G__25634; +chunk__25615_25623 = G__25635; +count__25616_25624 = G__25636; +i__25617_25625 = G__25637; +continue; +} else { +var child_25638 = cljs.core.first.call(null,seq__25614_25632__$1); +viz.core.draw_lines.call(null,forest,node,child_25638,scale_fn); + + +var G__25639 = cljs.core.next.call(null,seq__25614_25632__$1); +var G__25640 = null; +var G__25641 = (0); +var G__25642 = (0); +seq__25614_25622 = G__25639; +chunk__25615_25623 = G__25640; +count__25616_25624 = G__25641; +i__25617_25625 = G__25642; +continue; +} +} else { +} +} +break; +} +} else { +var in_line_child_25643 = cljs.core.some.call(null,((function (children){ +return (function (p1__25613_SHARP_){ +if(cljs.core.truth_(viz.core.in_line_QMARK_.call(null,parent,node,p1__25613_SHARP_))){ +return p1__25613_SHARP_; +} else { +return null; +} +});})(children)) +,children); +var seq__25618_25644 = cljs.core.seq.call(null,children); +var chunk__25619_25645 = null; +var count__25620_25646 = (0); +var i__25621_25647 = (0); +while(true){ +if((i__25621_25647 < count__25620_25646)){ +var child_25648 = cljs.core._nth.call(null,chunk__25619_25645,i__25621_25647); +if(cljs.core.truth_((function (){var and__4036__auto__ = in_line_child_25643; +if(cljs.core.truth_(and__4036__auto__)){ +return cljs.core._EQ_.call(null,in_line_child_25643,child_25648); +} else { +return and__4036__auto__; +} +})())){ +viz.core.draw_lines.call(null,forest,parent,child_25648,scale_fn); +} else { +viz.core.draw_lines.call(null,forest,node,child_25648,scale_fn); +} + + +var G__25649 = seq__25618_25644; +var G__25650 = chunk__25619_25645; +var G__25651 = count__25620_25646; +var G__25652 = (i__25621_25647 + (1)); +seq__25618_25644 = G__25649; +chunk__25619_25645 = G__25650; +count__25620_25646 = G__25651; +i__25621_25647 = G__25652; +continue; +} else { +var temp__4657__auto___25653 = cljs.core.seq.call(null,seq__25618_25644); +if(temp__4657__auto___25653){ +var seq__25618_25654__$1 = temp__4657__auto___25653; +if(cljs.core.chunked_seq_QMARK_.call(null,seq__25618_25654__$1)){ +var c__4461__auto___25655 = cljs.core.chunk_first.call(null,seq__25618_25654__$1); +var G__25656 = cljs.core.chunk_rest.call(null,seq__25618_25654__$1); +var G__25657 = c__4461__auto___25655; +var G__25658 = cljs.core.count.call(null,c__4461__auto___25655); +var G__25659 = (0); +seq__25618_25644 = G__25656; +chunk__25619_25645 = G__25657; +count__25620_25646 = G__25658; +i__25621_25647 = G__25659; +continue; +} else { +var child_25660 = cljs.core.first.call(null,seq__25618_25654__$1); +if(cljs.core.truth_((function (){var and__4036__auto__ = in_line_child_25643; +if(cljs.core.truth_(and__4036__auto__)){ +return cljs.core._EQ_.call(null,in_line_child_25643,child_25660); +} else { +return and__4036__auto__; +} +})())){ +viz.core.draw_lines.call(null,forest,parent,child_25660,scale_fn); +} else { +viz.core.draw_lines.call(null,forest,node,child_25660,scale_fn); +} + + +var G__25661 = cljs.core.next.call(null,seq__25618_25654__$1); +var G__25662 = null; +var G__25663 = (0); +var G__25664 = (0); +seq__25618_25644 = G__25661; +chunk__25619_25645 = G__25662; +count__25620_25646 = G__25663; +i__25621_25647 = G__25664; +continue; +} +} else { +} +} +break; +} + +if(cljs.core.truth_(in_line_child_25643)){ +} else { +viz.core.draw_line.call(null,node,parent,scale_fn); +} +} + +if(cljs.core.empty_QMARK_.call(null,children)){ +return viz.core.draw_node.call(null,node,false,scale_fn); +} else { +return null; +} +}); +viz.core.draw_dial = (function viz$core$draw_dial(state,dial,posL,posR){ +var dial_norm = quil.core.norm.call(null,new cljs.core.Keyword(null,"val","val",128701612).cljs$core$IFn$_invoke$arity$1(dial),new cljs.core.Keyword(null,"min","min",444991522).cljs$core$IFn$_invoke$arity$1(dial),new cljs.core.Keyword(null,"max","max",61366548).cljs$core$IFn$_invoke$arity$1(dial)); +var dial_pos = cljs.core.map.call(null,((function (dial_norm){ +return (function (p1__25665_SHARP_,p2__25666_SHARP_){ +return quil.core.lerp.call(null,p1__25665_SHARP_,p2__25666_SHARP_,dial_norm); +});})(dial_norm)) +,posL,posR); +quil.core.stroke.call(null,(4278190080)); + +quil.core.stroke_weight.call(null,(1)); + +quil.core.fill.call(null,(4278190080)); + +cljs.core.apply.call(null,quil.core.line,cljs.core.concat.call(null,posL,posR)); + +return cljs.core.apply.call(null,quil.core.ellipse,cljs.core.concat.call(null,dial_pos,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(5),(5)], null))); +}); +viz.core.draw_state = (function viz$core$draw_state(state){ +quil.core.background.call(null,(4294967295)); + +var tr__1504__auto__ = viz.core.window_half_size; +quil.core.push_matrix.call(null); + +try{quil.core.translate.call(null,tr__1504__auto__); + +var grid_size = new cljs.core.Keyword(null,"grid-size","grid-size",2138480144).cljs$core$IFn$_invoke$arity$1(state); +var scale_fn = ((function (grid_size,tr__1504__auto__){ +return (function (p1__25667_SHARP_){ +return viz.core.scale.call(null,grid_size,p1__25667_SHARP_); +});})(grid_size,tr__1504__auto__)) +; +var ghost = new cljs.core.Keyword(null,"ghost","ghost",-1531157576).cljs$core$IFn$_invoke$arity$1(state); +var forest = new cljs.core.Keyword(null,"forest","forest",278860306).cljs$core$IFn$_invoke$arity$1(state); +var roots = viz.forest.roots.call(null,forest); +var seq__25669_25685 = cljs.core.seq.call(null,roots); +var chunk__25670_25686 = null; +var count__25671_25687 = (0); +var i__25672_25688 = (0); +while(true){ +if((i__25672_25688 < count__25671_25687)){ +var root_25689 = cljs.core._nth.call(null,chunk__25670_25686,i__25672_25688); +viz.core.draw_lines.call(null,forest,null,root_25689,scale_fn); + + +var G__25690 = seq__25669_25685; +var G__25691 = chunk__25670_25686; +var G__25692 = count__25671_25687; +var G__25693 = (i__25672_25688 + (1)); +seq__25669_25685 = G__25690; +chunk__25670_25686 = G__25691; +count__25671_25687 = G__25692; +i__25672_25688 = G__25693; +continue; +} else { +var temp__4657__auto___25694 = cljs.core.seq.call(null,seq__25669_25685); +if(temp__4657__auto___25694){ +var seq__25669_25695__$1 = temp__4657__auto___25694; +if(cljs.core.chunked_seq_QMARK_.call(null,seq__25669_25695__$1)){ +var c__4461__auto___25696 = cljs.core.chunk_first.call(null,seq__25669_25695__$1); +var G__25697 = cljs.core.chunk_rest.call(null,seq__25669_25695__$1); +var G__25698 = c__4461__auto___25696; +var G__25699 = cljs.core.count.call(null,c__4461__auto___25696); +var G__25700 = (0); +seq__25669_25685 = G__25697; +chunk__25670_25686 = G__25698; +count__25671_25687 = G__25699; +i__25672_25688 = G__25700; +continue; +} else { +var root_25701 = cljs.core.first.call(null,seq__25669_25695__$1); +viz.core.draw_lines.call(null,forest,null,root_25701,scale_fn); + + +var G__25702 = cljs.core.next.call(null,seq__25669_25695__$1); +var G__25703 = null; +var G__25704 = (0); +var G__25705 = (0); +seq__25669_25685 = G__25702; +chunk__25670_25686 = G__25703; +count__25671_25687 = G__25704; +i__25672_25688 = G__25705; +continue; +} +} else { +} +} +break; +} + +var seq__25673 = cljs.core.seq.call(null,new cljs.core.Keyword(null,"ghosts","ghosts",665819293).cljs$core$IFn$_invoke$arity$1(state)); +var chunk__25674 = null; +var count__25675 = (0); +var i__25676 = (0); +while(true){ +if((i__25676 < count__25675)){ +var ghost__$1 = cljs.core._nth.call(null,chunk__25674,i__25676); +var seq__25677_25706 = cljs.core.seq.call(null,cljs.core.map.call(null,((function (seq__25673,chunk__25674,count__25675,i__25676,ghost__$1,grid_size,scale_fn,ghost,forest,roots,tr__1504__auto__){ +return (function (p1__25668_SHARP_){ +return viz.forest.get_node.call(null,forest,p1__25668_SHARP_); +});})(seq__25673,chunk__25674,count__25675,i__25676,ghost__$1,grid_size,scale_fn,ghost,forest,roots,tr__1504__auto__)) +,new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751).cljs$core$IFn$_invoke$arity$1(ghost__$1))); +var chunk__25678_25707 = null; +var count__25679_25708 = (0); +var i__25680_25709 = (0); +while(true){ +if((i__25680_25709 < count__25679_25708)){ +var active_node_25710 = cljs.core._nth.call(null,chunk__25678_25707,i__25680_25709); +viz.core.draw_node.call(null,active_node_25710,true,scale_fn); + + +var G__25711 = seq__25677_25706; +var G__25712 = chunk__25678_25707; +var G__25713 = count__25679_25708; +var G__25714 = (i__25680_25709 + (1)); +seq__25677_25706 = G__25711; +chunk__25678_25707 = G__25712; +count__25679_25708 = G__25713; +i__25680_25709 = G__25714; +continue; +} else { +var temp__4657__auto___25715 = cljs.core.seq.call(null,seq__25677_25706); +if(temp__4657__auto___25715){ +var seq__25677_25716__$1 = temp__4657__auto___25715; +if(cljs.core.chunked_seq_QMARK_.call(null,seq__25677_25716__$1)){ +var c__4461__auto___25717 = cljs.core.chunk_first.call(null,seq__25677_25716__$1); +var G__25718 = cljs.core.chunk_rest.call(null,seq__25677_25716__$1); +var G__25719 = c__4461__auto___25717; +var G__25720 = cljs.core.count.call(null,c__4461__auto___25717); +var G__25721 = (0); +seq__25677_25706 = G__25718; +chunk__25678_25707 = G__25719; +count__25679_25708 = G__25720; +i__25680_25709 = G__25721; +continue; +} else { +var active_node_25722 = cljs.core.first.call(null,seq__25677_25716__$1); +viz.core.draw_node.call(null,active_node_25722,true,scale_fn); + + +var G__25723 = cljs.core.next.call(null,seq__25677_25716__$1); +var G__25724 = null; +var G__25725 = (0); +var G__25726 = (0); +seq__25677_25706 = G__25723; +chunk__25678_25707 = G__25724; +count__25679_25708 = G__25725; +i__25680_25709 = G__25726; +continue; +} +} else { +} +} +break; +} + + +var G__25727 = seq__25673; +var G__25728 = chunk__25674; +var G__25729 = count__25675; +var G__25730 = (i__25676 + (1)); +seq__25673 = G__25727; +chunk__25674 = G__25728; +count__25675 = G__25729; +i__25676 = G__25730; +continue; +} else { +var temp__4657__auto__ = cljs.core.seq.call(null,seq__25673); +if(temp__4657__auto__){ +var seq__25673__$1 = temp__4657__auto__; +if(cljs.core.chunked_seq_QMARK_.call(null,seq__25673__$1)){ +var c__4461__auto__ = cljs.core.chunk_first.call(null,seq__25673__$1); +var G__25731 = cljs.core.chunk_rest.call(null,seq__25673__$1); +var G__25732 = c__4461__auto__; +var G__25733 = cljs.core.count.call(null,c__4461__auto__); +var G__25734 = (0); +seq__25673 = G__25731; +chunk__25674 = G__25732; +count__25675 = G__25733; +i__25676 = G__25734; +continue; +} else { +var ghost__$1 = cljs.core.first.call(null,seq__25673__$1); +var seq__25681_25735 = cljs.core.seq.call(null,cljs.core.map.call(null,((function (seq__25673,chunk__25674,count__25675,i__25676,ghost__$1,seq__25673__$1,temp__4657__auto__,grid_size,scale_fn,ghost,forest,roots,tr__1504__auto__){ +return (function (p1__25668_SHARP_){ +return viz.forest.get_node.call(null,forest,p1__25668_SHARP_); +});})(seq__25673,chunk__25674,count__25675,i__25676,ghost__$1,seq__25673__$1,temp__4657__auto__,grid_size,scale_fn,ghost,forest,roots,tr__1504__auto__)) +,new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751).cljs$core$IFn$_invoke$arity$1(ghost__$1))); +var chunk__25682_25736 = null; +var count__25683_25737 = (0); +var i__25684_25738 = (0); +while(true){ +if((i__25684_25738 < count__25683_25737)){ +var active_node_25739 = cljs.core._nth.call(null,chunk__25682_25736,i__25684_25738); +viz.core.draw_node.call(null,active_node_25739,true,scale_fn); + + +var G__25740 = seq__25681_25735; +var G__25741 = chunk__25682_25736; +var G__25742 = count__25683_25737; +var G__25743 = (i__25684_25738 + (1)); +seq__25681_25735 = G__25740; +chunk__25682_25736 = G__25741; +count__25683_25737 = G__25742; +i__25684_25738 = G__25743; +continue; +} else { +var temp__4657__auto___25744__$1 = cljs.core.seq.call(null,seq__25681_25735); +if(temp__4657__auto___25744__$1){ +var seq__25681_25745__$1 = temp__4657__auto___25744__$1; +if(cljs.core.chunked_seq_QMARK_.call(null,seq__25681_25745__$1)){ +var c__4461__auto___25746 = cljs.core.chunk_first.call(null,seq__25681_25745__$1); +var G__25747 = cljs.core.chunk_rest.call(null,seq__25681_25745__$1); +var G__25748 = c__4461__auto___25746; +var G__25749 = cljs.core.count.call(null,c__4461__auto___25746); +var G__25750 = (0); +seq__25681_25735 = G__25747; +chunk__25682_25736 = G__25748; +count__25683_25737 = G__25749; +i__25684_25738 = G__25750; +continue; +} else { +var active_node_25751 = cljs.core.first.call(null,seq__25681_25745__$1); +viz.core.draw_node.call(null,active_node_25751,true,scale_fn); + + +var G__25752 = cljs.core.next.call(null,seq__25681_25745__$1); +var G__25753 = null; +var G__25754 = (0); +var G__25755 = (0); +seq__25681_25735 = G__25752; +chunk__25682_25736 = G__25753; +count__25683_25737 = G__25754; +i__25684_25738 = G__25755; +continue; +} +} else { +} +} +break; +} + + +var G__25756 = cljs.core.next.call(null,seq__25673__$1); +var G__25757 = null; +var G__25758 = (0); +var G__25759 = (0); +seq__25673 = G__25756; +chunk__25674 = G__25757; +count__25675 = G__25758; +i__25676 = G__25759; +continue; +} +} else { +return null; +} +} +break; +} +}finally {quil.core.pop_matrix.call(null); +}}); +viz.core.viz = (function viz$core$viz(){ +return quil.sketch.sketch.call(null,new cljs.core.Keyword(null,"host","host",-1558485167),"viz",new cljs.core.Keyword(null,"features","features",-1146962336),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"keep-on-top","keep-on-top",-970284267)], null),new cljs.core.Keyword(null,"update","update",1045576396),((cljs.core.fn_QMARK_.call(null,viz.core.update_state))?(function() { +var G__25760__delegate = function (args){ +return cljs.core.apply.call(null,viz.core.update_state,args); +}; +var G__25760 = function (var_args){ +var args = null; +if (arguments.length > 0) { +var G__25761__i = 0, G__25761__a = new Array(arguments.length - 0); +while (G__25761__i < G__25761__a.length) {G__25761__a[G__25761__i] = arguments[G__25761__i + 0]; ++G__25761__i;} + args = new cljs.core.IndexedSeq(G__25761__a,0,null); +} +return G__25760__delegate.call(this,args);}; +G__25760.cljs$lang$maxFixedArity = 0; +G__25760.cljs$lang$applyTo = (function (arglist__25762){ +var args = cljs.core.seq(arglist__25762); +return G__25760__delegate(args); +}); +G__25760.cljs$core$IFn$_invoke$arity$variadic = G__25760__delegate; +return G__25760; +})() +:viz.core.update_state),new cljs.core.Keyword(null,"size","size",1098693007),((cljs.core.fn_QMARK_.call(null,viz.core.window_size))?(function() { +var G__25763__delegate = function (args){ +return cljs.core.apply.call(null,viz.core.window_size,args); +}; +var G__25763 = function (var_args){ +var args = null; +if (arguments.length > 0) { +var G__25764__i = 0, G__25764__a = new Array(arguments.length - 0); +while (G__25764__i < G__25764__a.length) {G__25764__a[G__25764__i] = arguments[G__25764__i + 0]; ++G__25764__i;} + args = new cljs.core.IndexedSeq(G__25764__a,0,null); +} +return G__25763__delegate.call(this,args);}; +G__25763.cljs$lang$maxFixedArity = 0; +G__25763.cljs$lang$applyTo = (function (arglist__25765){ +var args = cljs.core.seq(arglist__25765); +return G__25763__delegate(args); +}); +G__25763.cljs$core$IFn$_invoke$arity$variadic = G__25763__delegate; +return G__25763; +})() +:viz.core.window_size),new cljs.core.Keyword(null,"title","title",636505583),"",new cljs.core.Keyword(null,"setup","setup",1987730512),((cljs.core.fn_QMARK_.call(null,viz.core.setup))?(function() { +var G__25766__delegate = function (args){ +return cljs.core.apply.call(null,viz.core.setup,args); +}; +var G__25766 = function (var_args){ +var args = null; +if (arguments.length > 0) { +var G__25767__i = 0, G__25767__a = new Array(arguments.length - 0); +while (G__25767__i < G__25767__a.length) {G__25767__a[G__25767__i] = arguments[G__25767__i + 0]; ++G__25767__i;} + args = new cljs.core.IndexedSeq(G__25767__a,0,null); +} +return G__25766__delegate.call(this,args);}; +G__25766.cljs$lang$maxFixedArity = 0; +G__25766.cljs$lang$applyTo = (function (arglist__25768){ +var args = cljs.core.seq(arglist__25768); +return G__25766__delegate(args); +}); +G__25766.cljs$core$IFn$_invoke$arity$variadic = G__25766__delegate; +return G__25766; +})() +:viz.core.setup),new cljs.core.Keyword(null,"middleware","middleware",1462115504),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [quil.middleware.fun_mode], null),new cljs.core.Keyword(null,"draw","draw",1358331674),((cljs.core.fn_QMARK_.call(null,viz.core.draw_state))?(function() { +var G__25769__delegate = function (args){ +return cljs.core.apply.call(null,viz.core.draw_state,args); +}; +var G__25769 = function (var_args){ +var args = null; +if (arguments.length > 0) { +var G__25770__i = 0, G__25770__a = new Array(arguments.length - 0); +while (G__25770__i < G__25770__a.length) {G__25770__a[G__25770__i] = arguments[G__25770__i + 0]; ++G__25770__i;} + args = new cljs.core.IndexedSeq(G__25770__a,0,null); +} +return G__25769__delegate.call(this,args);}; +G__25769.cljs$lang$maxFixedArity = 0; +G__25769.cljs$lang$applyTo = (function (arglist__25771){ +var args = cljs.core.seq(arglist__25771); +return G__25769__delegate(args); +}); +G__25769.cljs$core$IFn$_invoke$arity$variadic = G__25769__delegate; +return G__25769; +})() +:viz.core.draw_state)); +}); +goog.exportSymbol('viz.core.viz', viz.core.viz); + +if(cljs.core.truth_(cljs.core.some.call(null,(function (p1__1117__1118__auto__){ +return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"no-start","no-start",1381488856),p1__1117__1118__auto__); +}),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"keep-on-top","keep-on-top",-970284267)], null)))){ +} else { +quil.sketch.add_sketch_to_init_list.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"fn","fn",-1175266204),viz.core.viz,new cljs.core.Keyword(null,"host-id","host-id",742376279),"viz"], null)); +} + +//# sourceMappingURL=core.js.map diff --git a/static/src/assets/viz/2/viz/core.js.map b/static/src/assets/viz/2/viz/core.js.map new file mode 100644 index 0000000..1bee43b --- /dev/null +++ b/static/src/assets/viz/2/viz/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/viz\/core.js","sources":["core.cljs"],"lineCount":753,"mappings":";AAAA;;;;;;;;;;AAWA,AAAA,iBAAA,yBAAA,1CAAOI;AAAP,AAAA,IAAA,qBAAA;AAAA,AAAA,IAAA,0BAAA,AAAA;AAAA,AAAA,IAAA,wBAAA;;AAAA,AAAA,GAAA,CAAAJ,wBAAAC;AAAA,AAAA,AAAAC,wBAAA,CAAA,UAAAF;;AAAA,eAAA,CAAAA,wBAAA;;;;AAAA;;;;AAAA,IAAA,uBAAA,EAAA,CAAA,MAAA,AAAAE,4BAAA,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;;;;;AADF;AAAA,eAAA,AAAA9C,yBAAAsC;eAAA;eAAA;eAAA;;;;;;;;AAAA;;;;;UAZJ,AAAA,AAAAX;;AAiCF,AAAA,eAAA,fAAa0B;AAAb,AAAA,OAAAJ,6BAAA,sDAAA,MAAA,8DAAA,mFAAA,2EAAA,yDAAA,EAAA,AAAAC,sDAAA,xBAOUjG;mCAPV;AAAA,AAAA,OAAAtF,gDAAAb,tBAOUmG;;;IAPV;;;;EAAA;;oCAAA;;;IAAA;0BAAA;;;;;wBAAA,qDAAA,EAAA,AAAAiG,qDAAA,vBAGQ5L,5GAIE2F;mCAPV;AAAA,AAAA,OAAAtF,+CAAAb,rBAGQQ;;;IAHR;;;;EAAA;;oCAAA;;;IAAA;0BAAA;;;;;uBAAA,sDAAA,GAAA,uDAAA,EAAA,AAAA4L,+CAAA,vLAGQ5L,sKAEC6B;mCALT;AAAA,AAAA,OAAAxB,yCAAAb,fAKSqC;;;IALT;;;;EAAA;;oCAAA;;;IAAA;0BAAA;;;;;iBAAA,iEAAA,oHAAA,qDAAA,EAAA,AAAA+J,oDAAA,hTAKS\/J,0RAGDmI,tHAKOgC;mCAbf;AAAA,AAAA,OAAA3L,8CAAAb,pBAQQwK;;;IARR;;;;EAAA;;oCAAA;;;IAAA;0BAAA;;;;;CAQQA;;;;AARR,oBAAA,AAAAnB,yBAAA,WAAA;AAAA,AAAA,OAAArC,yBAAA,6DAAAqF;GAAA,mFAAA;AAAA;AAAA,AAAA,AAAAC,8CAAA,2CAAA,+DAAA,0DAAA,vEAAaC","names":["i__4642__auto__","len__4641__auto__","args__4647__auto__","cljs.core\/IndexedSeq","viz.core\/debug","argseq__4648__auto__","self__4629__auto__","cljs.core\/seq","seq25577","js\/console","clojure.string\/join","cljs.core\/map","cljs.core\/str","args","viz.core\/observe","v","viz.core\/positive","n","viz.core\/window-partial","js\/document","k","viz.core\/window-size","x__4138__auto__","y__4139__auto__","w","viz.core\/window-half-size","cljs.core\/apply","cljs.core\/vector","p1__25581#","viz.core\/set-grid-size","state","cljs.core\/assoc","h","viz.core\/add-ghost","cljs.core\/nth","vec__25582","viz.forest\/add-node","ghost-def","viz.ghost\/new-ghost","viz.ghost\/add-active-node","id","forest","cljs.core\/cons","ghost","viz.core\/new-state","viz.forest\/new-forest","viz.grid\/isometric","quil.core\/color","cljs.core\/mod","frames-per-color-cycle","viz.core\/setup","quil.core\/color-mode","viz.core\/curr-second","viz.core\/scale","cljs.core\/map-indexed","p2__25585#","p1__25586#","grid-size","xy","viz.core\/bounds-buffer","viz.core\/in-bounds?","vec__25589","p1__25587#","cljs.core\/every?","p1__25588#","pos","viz.core\/dist-from-sqr","cljs.core\/reduce","cljs.core\/+","p1__25592#","cljs.core\/-","pos1","pos2","viz.core\/dist-from","quil.core\/sqrt","viz.core\/take-adj-poss","grid-width","width","dist-from-center","cljs.core\/take","quil.core\/map-range","cljs.core\/rand","dist-ratio","cljs.core\/count","adj-poss","viz.core\/mk-poss-fn","cljs.core\/filter","p1__25593#","cljs.core\/sort-by","p1__25594#","viz.core\/update-ghost-forest","vec__25595","p__25598","vec__25599","vec__25602","update-fn","ghosts","cljs.core\/reverse","viz.core\/ghost-incr","p1__25605#","p2__25606#","viz.ghost\/incr","poss-fn","viz.core\/rm-nodes","viz.ghost\/rm-active-node","node-ids","viz.forest\/remove-node","viz.core\/maybe-remove-roots","viz.forest\/roots","viz.core\/ghost-set-color","cljs.core\/get-in","color","viz.core\/update-state","cljs.core\/update-in","cljs.core\/inc","viz.core\/draw-ellipse","scale-fn","cljs.core\/int","size","quil.core\/ellipse","cljs.core\/concat","scaled-pos","scaled-size","viz.core\/in-line?","seq25608","cljs.core\/=","p1__25607#","cljs.core\/partition","nodes","viz.core\/draw-node","node","active?","stroke","quil.core\/stroke","quil.core\/fill","fill","viz.core\/draw-line","quil.core\/lerp-color","node-color","parent-color","quil.core\/stroke-weight","quil.core\/line","cljs.core\/List","parent","viz.core\/draw-lines","p1__25612#","viz.forest\/get-node","cljs.core\/not","i__25617","count__25616","cljs.core\/-nth","chunk__25615","seq__25614","temp__4657__auto__","cljs.core\/chunked-seq?","cljs.core\/chunk-first","cljs.core\/chunk-rest","c__4461__auto__","cljs.core\/first","cljs.core\/next","children","child","cljs.core\/some","p1__25613#","i__25621","count__25620","chunk__25619","seq__25618","and__4036__auto__","in-line-child","cljs.core\/empty?","viz.core\/draw-dial","quil.core\/norm","dial","p1__25665#","p2__25666#","quil.core\/lerp","dial-norm","posL","posR","dial-pos","viz.core\/draw-state","quil.core\/background","quil.core\/push-matrix","quil.core\/translate","tr__1504__auto__","quil.core\/pop-matrix","p1__25667#","i__25672","count__25671","chunk__25670","seq__25669","roots","root","i__25676","count__25675","chunk__25674","seq__25673","i__25680","count__25679","chunk__25678","seq__25677","i__25684","count__25683","chunk__25682","seq__25681","p1__25668#","active-node","quil.sketch\/sketch","cljs.core\/fn?","p1__1117__1118__auto__","quil.sketch\/add-sketch-to-init-list","viz.core\/viz","quil.middleware\/fun-mode"]}
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/debug.cljs b/static/src/assets/viz/2/viz/debug.cljs new file mode 100644 index 0000000..9de3071 --- /dev/null +++ b/static/src/assets/viz/2/viz/debug.cljs @@ -0,0 +1,4 @@ +(ns viz.debug) + +(defn- log [& args] + (.log js/console (clojure.string/join " " (map str args)))) diff --git a/static/src/assets/viz/2/viz/debug.cljs.cache.json b/static/src/assets/viz/2/viz/debug.cljs.cache.json new file mode 100644 index 0000000..e2f0a33 --- /dev/null +++ b/static/src/assets/viz/2/viz/debug.cljs.cache.json @@ -0,0 +1 @@ +["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:externs",["^ ","~$console",["^ ","~$log",["^ "]]],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$viz.debug","~:imports",null,"~:requires",null,"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","^4",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/home/mediocregopher/src/viz/src/viz/debug.cljs","~:line",3,"~:column",8,"~:end-line",3,"~:end-column",11,"~:private",true,"~:arglists",["~#list",["~$quote",["^H",[["~$&","~$args"]]]]],"~:top-fn",["^ ","~:variadic?",true,"~:max-fixed-arity",0,"~:method-params",[["^H",["^J"]]],"^G",["^H",[["~$&","^J"]]],"~:arglists-meta",["^H",[null]]]],"^F",true,"^8","~$viz.debug/log","^A","src/viz/debug.cljs","^E",11,"^K",["^ ","^L",true,"^M",0,"^N",[["^H",["^J"]]],"^G",["^H",[["~$&","^J"]]],"^O",["^H",[null]]],"^N",[["^H",["^J"]]],"~:protocol-impl",null,"^O",["^H",[null]],"^C",1,"^L",true,"^B",3,"~:ret-tag","~$any","^D",3,"^M",0,"~:fn-var",true,"^G",["^H",[["~$&","^J"]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:doc",null]
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/debug.js b/static/src/assets/viz/2/viz/debug.js new file mode 100644 index 0000000..81683f9 --- /dev/null +++ b/static/src/assets/viz/2/viz/debug.js @@ -0,0 +1,37 @@ +// Compiled by ClojureScript 1.10.439 {} +goog.provide('viz.debug'); +goog.require('cljs.core'); +viz.debug.log = (function viz$debug$log(var_args){ +var args__4647__auto__ = []; +var len__4641__auto___2514 = arguments.length; +var i__4642__auto___2515 = (0); +while(true){ +if((i__4642__auto___2515 < len__4641__auto___2514)){ +args__4647__auto__.push((arguments[i__4642__auto___2515])); + +var G__2516 = (i__4642__auto___2515 + (1)); +i__4642__auto___2515 = G__2516; +continue; +} else { +} +break; +} + +var argseq__4648__auto__ = ((((0) < args__4647__auto__.length))?(new cljs.core.IndexedSeq(args__4647__auto__.slice((0)),(0),null)):null); +return viz.debug.log.cljs$core$IFn$_invoke$arity$variadic(argseq__4648__auto__); +}); + +viz.debug.log.cljs$core$IFn$_invoke$arity$variadic = (function (args){ +return console.log(clojure.string.join.call(null," ",cljs.core.map.call(null,cljs.core.str,args))); +}); + +viz.debug.log.cljs$lang$maxFixedArity = (0); + +/** @this {Function} */ +viz.debug.log.cljs$lang$applyTo = (function (seq2513){ +var self__4629__auto__ = this; +return self__4629__auto__.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq2513)); +}); + + +//# sourceMappingURL=debug.js.map diff --git a/static/src/assets/viz/2/viz/debug.js.map b/static/src/assets/viz/2/viz/debug.js.map new file mode 100644 index 0000000..fb46f64 --- /dev/null +++ b/static/src/assets/viz/2/viz/debug.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/viz\/debug.js","sources":["debug.cljs"],"lineCount":37,"mappings":";AAAA;;AAEA,AAAA,gBAAA,wBAAA,xCAAOI;AAAP,AAAA,IAAA,qBAAA;AAAA,AAAA,IAAA,yBAAA,AAAA;AAAA,AAAA,IAAA,uBAAA;;AAAA,AAAA,GAAA,CAAAJ,uBAAAC;AAAA,AAAA,AAAAC,wBAAA,CAAA,UAAAF;;AAAA,cAAA,CAAAA,uBAAA;;;;AAAA;;;;AAAA,IAAA,uBAAA,EAAA,CAAA,MAAA,AAAAE,4BAAA,AAAA,KAAAC,qBAAA,AAAAD,yBAAA,KAAA,IAAA,OAAA;AAAA,AAAA,OAAAE,mDAAAC;;;AAAA,AAAA,AAAA,AAAAD,qDAAA,WAAc;AAAd,AACE,OAAMK,YAAW,8BAAA,9BAACC,kCAAwB,AAACC,wBAAIC,cAAIC;;;AADrD,AAAA,AAAAT,wCAAA;;AAAA;AAAA,AAAA,AAAAA,kCAAA,WAAA;AAAA,AAAA,IAAA,qBAAA;AAAA,AAAA,OAAAE,wDAAA,AAAAC,wBAAAC;;;AAAA","names":["i__4642__auto__","len__4641__auto__","args__4647__auto__","cljs.core\/IndexedSeq","viz.debug\/log","argseq__4648__auto__","self__4629__auto__","cljs.core\/seq","seq2513","js\/console","clojure.string\/join","cljs.core\/map","cljs.core\/str","args"]}
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/dial.cljs b/static/src/assets/viz/2/viz/dial.cljs new file mode 100644 index 0000000..46656e5 --- /dev/null +++ b/static/src/assets/viz/2/viz/dial.cljs @@ -0,0 +1,42 @@ +(ns viz.dial + (:require [quil.core :as q])) + +(defn new-dial [] + {:val 0 + :min -1 + :max 1 + }) + +(defn- scale [v old-min old-max new-min new-max] + (+ new-min (* (- new-max new-min) + (/ (- v old-min) (- old-max old-min))))) + +(defn scaled [dial min max] + (let [new-val (scale (:val dial) (:min dial) (:max dial) min max)] + (assoc dial :min min :max max :val new-val))) + +(defn floored [dial at] + (if (< (:val dial) at) + (assoc dial :val at) + dial)) + +(defn invert [dial] + (assoc dial :val (* -1 (:val dial)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; plot is a sequence of [t val], where t is a normalized time value between 0 +; and 1, and val is the value the plot should become at that point. +(defn new-plot [frame-rate period-seconds plot] + {:frame-rate frame-rate + :period period-seconds + :plot plot}) + +(defn by-plot [dial plot curr-frame] + (let [dial-t (/ (mod (/ curr-frame (:frame-rate plot)) (:period plot)) (:period plot)) + ] + (assoc dial :val + (reduce + (fn [curr-v [t v]] (if (<= t dial-t) v (reduced curr-v))) + 0 (:plot plot))) + )) diff --git a/static/src/assets/viz/2/viz/dial.cljs.cache.json b/static/src/assets/viz/2/viz/dial.cljs.cache.json new file mode 100644 index 0000000..da9fe18 --- /dev/null +++ b/static/src/assets/viz/2/viz/dial.cljs.cache.json @@ -0,0 +1 @@ +["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$viz.dial","~:imports",null,"~:requires",["^ ","~$q","~$quil.core","^9","^9"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$new-dial",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/home/mediocregopher/src/viz/src/viz/dial.cljs","~:line",4,"~:column",7,"~:end-line",4,"~:end-column",15,"~:arglists",["~#list",["~$quote",["^F",[[]]]]]],"^5","~$viz.dial/new-dial","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^D",15,"~:method-params",["^F",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^F",[null,null]],"^B",1,"~:variadic?",false,"^A",4,"~:ret-tag","~$cljs.core/IMap","^C",4,"~:max-fixed-arity",0,"~:fn-var",true,"^E",["^F",["^G",["^F",[[]]]]]],"~$scale",["^ ","^>",null,"^?",["^ ","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^A",10,"^B",8,"^C",10,"^D",13,"~:private",true,"^E",["^F",["^G",["^F",[["~$v","~$old-min","~$old-max","~$new-min","~$new-max"]]]]]],"^R",true,"^5","~$viz.dial/scale","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^D",13,"^I",["^F",[["~$v","^S","^T","^U","^V"]]],"^J",null,"^K",["^F",[null,null]],"^B",1,"^L",false,"^A",10,"^M","~$number","^C",10,"^O",5,"^P",true,"^E",["^F",["^G",["^F",[["~$v","^S","^T","^U","^V"]]]]]],"~$scaled",["^ ","^>",null,"^?",["^ ","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^A",14,"^B",7,"^C",14,"^D",13,"^E",["^F",["^G",["^F",[["~$dial","~$min","~$max"]]]]]],"^5","~$viz.dial/scaled","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^D",13,"^I",["^F",[["^Z","^[","^10"]]],"^J",null,"^K",["^F",[null,null]],"^B",1,"^L",false,"^A",14,"^M","~$any","^C",14,"^O",3,"^P",true,"^E",["^F",["^G",["^F",[["^Z","^[","^10"]]]]]],"~$floored",["^ ","^>",null,"^?",["^ ","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^A",18,"^B",7,"^C",18,"^D",14,"^E",["^F",["^G",["^F",[["^Z","~$at"]]]]]],"^5","~$viz.dial/floored","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^D",14,"^I",["^F",[["^Z","^14"]]],"^J",null,"^K",["^F",[null,null]],"^B",1,"^L",false,"^A",18,"^M",["^4",[null,"^12"]],"^C",18,"^O",2,"^P",true,"^E",["^F",["^G",["^F",[["^Z","^14"]]]]]],"~$invert",["^ ","^>",null,"^?",["^ ","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^A",23,"^B",7,"^C",23,"^D",13,"^E",["^F",["^G",["^F",[["^Z"]]]]]],"^5","~$viz.dial/invert","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^D",13,"^I",["^F",[["^Z"]]],"^J",null,"^K",["^F",[null,null]],"^B",1,"^L",false,"^A",23,"^M","^12","^C",23,"^O",1,"^P",true,"^E",["^F",["^G",["^F",[["^Z"]]]]]],"~$new-plot",["^ ","^>",null,"^?",["^ ","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^A",30,"^B",7,"^C",30,"^D",15,"^E",["^F",["^G",["^F",[["~$frame-rate","~$period-seconds","~$plot"]]]]]],"^5","~$viz.dial/new-plot","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^D",15,"^I",["^F",[["^19","^1:","^1;"]]],"^J",null,"^K",["^F",[null,null]],"^B",1,"^L",false,"^A",30,"^M","^N","^C",30,"^O",3,"^P",true,"^E",["^F",["^G",["^F",[["^19","^1:","^1;"]]]]]],"~$by-plot",["^ ","^>",null,"^?",["^ ","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^A",35,"^B",7,"^C",35,"^D",14,"^E",["^F",["^G",["^F",[["^Z","^1;","~$curr-frame"]]]]]],"^5","~$viz.dial/by-plot","^@","/home/mediocregopher/src/viz/src/viz/dial.cljs","^D",14,"^I",["^F",[["^Z","^1;","^1>"]]],"^J",null,"^K",["^F",[null,null]],"^B",1,"^L",false,"^A",35,"^M","^12","^C",35,"^O",3,"^P",true,"^E",["^F",["^G",["^F",[["^Z","^1;","^1>"]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:plot","~:min","~:frame-rate","~:val","~:max","~:period"]],"~:order",["^1G","^1E","^1H","^1F","^1I","^1D"]],"~:doc",null]
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/dial.js b/static/src/assets/viz/2/viz/dial.js new file mode 100644 index 0000000..3eb17f2 --- /dev/null +++ b/static/src/assets/viz/2/viz/dial.js @@ -0,0 +1,44 @@ +// Compiled by ClojureScript 1.10.439 {} +goog.provide('viz.dial'); +goog.require('cljs.core'); +goog.require('quil.core'); +viz.dial.new_dial = (function viz$dial$new_dial(){ +return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"val","val",128701612),(0),new cljs.core.Keyword(null,"min","min",444991522),(-1),new cljs.core.Keyword(null,"max","max",61366548),(1)], null); +}); +viz.dial.scale = (function viz$dial$scale(v,old_min,old_max,new_min,new_max){ +return (new_min + ((new_max - new_min) * ((v - old_min) / (old_max - old_min)))); +}); +viz.dial.scaled = (function viz$dial$scaled(dial,min,max){ +var new_val = viz.dial.scale.call(null,new cljs.core.Keyword(null,"val","val",128701612).cljs$core$IFn$_invoke$arity$1(dial),new cljs.core.Keyword(null,"min","min",444991522).cljs$core$IFn$_invoke$arity$1(dial),new cljs.core.Keyword(null,"max","max",61366548).cljs$core$IFn$_invoke$arity$1(dial),min,max); +return cljs.core.assoc.call(null,dial,new cljs.core.Keyword(null,"min","min",444991522),min,new cljs.core.Keyword(null,"max","max",61366548),max,new cljs.core.Keyword(null,"val","val",128701612),new_val); +}); +viz.dial.floored = (function viz$dial$floored(dial,at){ +if((new cljs.core.Keyword(null,"val","val",128701612).cljs$core$IFn$_invoke$arity$1(dial) < at)){ +return cljs.core.assoc.call(null,dial,new cljs.core.Keyword(null,"val","val",128701612),at); +} else { +return dial; +} +}); +viz.dial.invert = (function viz$dial$invert(dial){ +return cljs.core.assoc.call(null,dial,new cljs.core.Keyword(null,"val","val",128701612),((-1) * new cljs.core.Keyword(null,"val","val",128701612).cljs$core$IFn$_invoke$arity$1(dial))); +}); +viz.dial.new_plot = (function viz$dial$new_plot(frame_rate,period_seconds,plot){ +return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"frame-rate","frame-rate",-994918942),frame_rate,new cljs.core.Keyword(null,"period","period",-352129191),period_seconds,new cljs.core.Keyword(null,"plot","plot",2086832225),plot], null); +}); +viz.dial.by_plot = (function viz$dial$by_plot(dial,plot,curr_frame){ +var dial_t = (cljs.core.mod.call(null,(curr_frame / new cljs.core.Keyword(null,"frame-rate","frame-rate",-994918942).cljs$core$IFn$_invoke$arity$1(plot)),new cljs.core.Keyword(null,"period","period",-352129191).cljs$core$IFn$_invoke$arity$1(plot)) / new cljs.core.Keyword(null,"period","period",-352129191).cljs$core$IFn$_invoke$arity$1(plot)); +return cljs.core.assoc.call(null,dial,new cljs.core.Keyword(null,"val","val",128701612),cljs.core.reduce.call(null,((function (dial_t){ +return (function (curr_v,p__10882){ +var vec__10883 = p__10882; +var t = cljs.core.nth.call(null,vec__10883,(0),null); +var v = cljs.core.nth.call(null,vec__10883,(1),null); +if((t <= dial_t)){ +return v; +} else { +return cljs.core.reduced.call(null,curr_v); +} +});})(dial_t)) +,(0),new cljs.core.Keyword(null,"plot","plot",2086832225).cljs$core$IFn$_invoke$arity$1(plot))); +}); + +//# sourceMappingURL=dial.js.map diff --git a/static/src/assets/viz/2/viz/dial.js.map b/static/src/assets/viz/2/viz/dial.js.map new file mode 100644 index 0000000..213c641 --- /dev/null +++ b/static/src/assets/viz/2/viz/dial.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/viz\/dial.js","sources":["dial.cljs"],"lineCount":44,"mappings":";AAAA;;;AAGA,oBAAA,pBAAMA;AAAN,AAAA,kDAAA,kDAAA,IAAA,kDAAA,KAAA,iDAAA;;AAMA,iBAAA,jBAAOC,0CAAO,EAAE,QAAQ,QAAQ,QAAQ;AAAxC,AACE,QAAGC,UAAQ,CAAG,CAAGC,UAAQD,WACX,CAAG,CAAGE,IAAEC,WAAS,CAAGC,UAAQD;;AAE5C,kBAAA,lBAAME,4CAAQ,KAAK,IAAI;AAAvB,AACE,IAAM,UAAQ,AAACN,yBAAM,AAAA,gFAAMO,MAAM,AAAA,gFAAMA,MAAM,AAAA,+EAAMA,MAAMC,IAAIC;AAA7D,AACE,sCAAA,sDAAA,qDAAA,1IAACC,0BAAMH,uDAAUC,qDAASC,sDAASE;;AAEvC,mBAAA,nBAAMC,8CAAS,KAAK;AAApB,AACE,GAAI,CAAG,AAAA,gFAAML,QAAMM;AACjB,sCAAA,\/BAACH,0BAAMH,uDAAUM;;AACjBN;;;AAEJ,kBAAA,lBAAMO,4CAAQ;AAAd,AACE,sCAAA,\/BAACJ,0BAAMH,uDAAU,CAAA,OAAM,AAAA,gFAAMA;;AAM\/B,oBAAA,pBAAMQ,gDAAU,WAAW,eAAe;AAA1C,AAAA,kDAAA,4EAAA,wEAAA,nFACeC,oEACJC,oEACFC;;AAET,mBAAA,nBAAMC,8CAAS,KAAK,KAAK;AAAzB,AACE,IAAM,SAAO,CAAG,AAACC,wBAAI,CAAGC,aAAW,AAAA,+FAAaH,OAAO,AAAA,uFAASA,SAAO,AAAA,uFAASA;AAAhF,AAEE,sCAAA,\/BAACR,0BAAMH,uDACA,AAACe,2BACC;yBAAA,PAAK;AAAL,AAAA,IAAA,aAAAC;QAAA,AAAAC,wBAAAC,WAAA,IAAA,3CAAa;QAAb,AAAAD,wBAAAC,WAAA,IAAA,3CAAe;AAAf,AAAmB,GAAI,CAAIC,KAAEC;AAAQxB;;AAAE,OAACyB,4BAAQC;;;CADlD,IAEI,AAAA,mFAAOX","names":["viz.dial\/new-dial","viz.dial\/scale","new-min","new-max","v","old-min","old-max","viz.dial\/scaled","dial","min","max","cljs.core\/assoc","new-val","viz.dial\/floored","at","viz.dial\/invert","viz.dial\/new-plot","frame-rate","period-seconds","plot","viz.dial\/by-plot","cljs.core\/mod","curr-frame","cljs.core\/reduce","p__10882","cljs.core\/nth","vec__10883","t","dial-t","cljs.core\/reduced","curr-v"]}
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/forest.cljs b/static/src/assets/viz/2/viz/forest.cljs new file mode 100644 index 0000000..ee6a2fb --- /dev/null +++ b/static/src/assets/viz/2/viz/forest.cljs @@ -0,0 +1,107 @@ +(ns viz.forest + (:require [viz.grid :as grid]) + ) + +(defn new-forest [grid-def] + {:grid (grid/new-grid grid-def) + :nodes {} + :roots #{} + :leaves #{} + :next-id 0}) + +(defn- new-id [forest] + (let [id (:next-id forest)] + [(assoc forest :next-id (inc id)) + id])) + +(defn- unset-parent [forest id parent-id] + (-> forest + (update-in [:nodes id] dissoc :parent-id :parent-pos) + (update-in [:nodes parent-id :child-ids] disj id) + (update-in [:roots] conj id) + (update-in [:leaves] conj parent-id) + )) + +(defn- set-parent [forest id parent-id] + (let [parent-pos (get-in forest [:nodes parent-id :pos]) + prev-parent-id (get-in forest [:nodes id :parent-id]) + ] + (-> forest + (assoc-in [:nodes id :parent-id] parent-id) + (assoc-in [:nodes id :parent-pos] parent-pos) + (update-in [:nodes parent-id :child-ids] #(if %1 (conj %1 id) #{id})) + (update-in [:roots] disj id) + (update-in [:leaves] disj parent-id) + ;; If there was a previous parent of the child, unset that shit + (#(if prev-parent-id (unset-parent %1 id prev-parent-id) %1)) + ))) + +(defn node-at-pos? [forest pos] + (boolean (some #(= pos (:pos %)) (vals (:nodes forest))))) + +(defn empty-adjacent-points [forest pos] + (grid/empty-adjacent-points (:grid forest) pos)) + +(defn add-node [forest pos] + (let [[forest id] (new-id forest) + forest (-> forest + (update-in [:grid] grid/add-point pos) + (assoc-in [:nodes id] {:id id :pos pos}) + (update-in [:roots] conj id) + (update-in [:leaves] conj id) + ) + ] + [forest id])) + +(defn remove-node [forest id] + (let [node (get-in forest [:nodes id]) + child-ids (:child-ids node) + parent-id (:parent-id node)] + (-> forest + (update-in [:grid] grid/rm-point (:pos node)) + ;; unset this node's parent, if it has one + (#(if parent-id (unset-parent %1 id parent-id) %1)) + ;; unset this node's children, if it has any + ((fn [forest] (reduce #(unset-parent %1 %2 id) forest child-ids))) + ;; remove from all top-level sets + (update-in [:nodes] dissoc id) + (update-in [:roots] disj id) + (update-in [:leaves] disj id) + ))) + +(defn update-node-meta [forest id f] + (update-in forest [:nodes id :meta] f)) + +(defn get-node-meta [forest id] + (get-in forest [:nodes id :meta])) + +(defn get-node [forest id] + (get-in forest [:nodes id])) + +(defn spawn-child [forest parent-id pos] + (let [[forest id] (add-node forest pos) + forest (-> forest + (set-parent id parent-id) + ) + ] + [forest id])) + +(defn roots [forest] (-> forest :nodes (select-keys (:roots forest)) (vals))) +(defn root? [node] (not (boolean (:parent-id node)))) + +(defn leaves [forest] (-> forest :nodes (select-keys (:leaves forest)) (vals))) +(defn leaf? [node] (empty? (:child-ids node))) + +(defn lines [forest] + (->> forest + (:nodes) + (vals) + (remove #(empty? (:parent-pos %))) + (map #(vector (:pos %) (:parent-pos %))) + )) + +;(let [forest (new-forest grid/isometric) +; [forest id0] (add-node forest [0 0]) +; forest (update-node-meta forest id0 #(assoc % :color :red)) +; ] +; (print (get-node-meta forest id0))) diff --git a/static/src/assets/viz/2/viz/forest.cljs.cache.json b/static/src/assets/viz/2/viz/forest.cljs.cache.json new file mode 100644 index 0000000..e45e9f2 --- /dev/null +++ b/static/src/assets/viz/2/viz/forest.cljs.cache.json @@ -0,0 +1 @@ +["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$viz.forest","~:imports",null,"~:requires",["^ ","~$grid","~$viz.grid","^:","^:"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$get-node-meta",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/home/mediocregopher/src/viz/src/viz/forest.cljs","~:line",75,"~:column",7,"~:end-line",75,"~:end-column",20,"~:arglists",["~#list",["~$quote",["^G",[["~$forest","~$id"]]]]]],"^5","~$viz.forest/get-node-meta","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",20,"~:method-params",["^G",[["^I","^J"]]],"~:protocol-impl",null,"~:arglists-meta",["^G",[null,null]],"^C",1,"~:variadic?",false,"^B",75,"~:ret-tag","~$any","^D",75,"~:max-fixed-arity",2,"~:fn-var",true,"^F",["^G",["^H",["^G",[["^I","^J"]]]]]],"~$get-node",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",78,"^C",7,"^D",78,"^E",15,"^F",["^G",["^H",["^G",[["^I","^J"]]]]]],"^5","~$viz.forest/get-node","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",15,"^L",["^G",[["^I","^J"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",78,"^P","^Q","^D",78,"^R",2,"^S",true,"^F",["^G",["^H",["^G",[["^I","^J"]]]]]],"~$add-node",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",45,"^C",7,"^D",45,"^E",15,"^F",["^G",["^H",["^G",[["^I","~$pos"]]]]]],"^5","~$viz.forest/add-node","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",15,"^L",["^G",[["^I","^W"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",45,"^P","~$cljs.core/IVector","^D",45,"^R",2,"^S",true,"^F",["^G",["^H",["^G",[["^I","^W"]]]]]],"~$set-parent",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",25,"^C",8,"^D",25,"^E",18,"~:private",true,"^F",["^G",["^H",["^G",[["^I","^J","~$parent-id"]]]]]],"^[",true,"^5","~$viz.forest/set-parent","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",18,"^L",["^G",[["^I","^J","^10"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",25,"^P",["^4",[null,"^Q"]],"^D",25,"^R",3,"^S",true,"^F",["^G",["^H",["^G",[["^I","^J","^10"]]]]]],"~$new-id",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",12,"^C",8,"^D",12,"^E",14,"^[",true,"^F",["^G",["^H",["^G",[["^I"]]]]]],"^[",true,"^5","~$viz.forest/new-id","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",14,"^L",["^G",[["^I"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",12,"^P","^Y","^D",12,"^R",1,"^S",true,"^F",["^G",["^H",["^G",[["^I"]]]]]],"~$root?",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",90,"^C",7,"^D",90,"^E",12,"^F",["^G",["^H",["^G",[["~$node"]]]]]],"^5","~$viz.forest/root?","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",12,"^L",["^G",[["^15"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",90,"^P","~$boolean","^D",90,"^R",1,"^S",true,"^F",["^G",["^H",["^G",[["^15"]]]]]],"~$empty-adjacent-points",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",42,"^C",7,"^D",42,"^E",28,"^F",["^G",["^H",["^G",[["^I","^W"]]]]]],"^5","~$viz.forest/empty-adjacent-points","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",28,"^L",["^G",[["^I","^W"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",42,"^P","^Q","^D",42,"^R",2,"^S",true,"^F",["^G",["^H",["^G",[["^I","^W"]]]]]],"~$new-forest",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",5,"^C",7,"^D",5,"^E",17,"^F",["^G",["^H",["^G",[["~$grid-def"]]]]]],"^5","~$viz.forest/new-forest","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",17,"^L",["^G",[["^1;"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",5,"^P","~$cljs.core/IMap","^D",5,"^R",1,"^S",true,"^F",["^G",["^H",["^G",[["^1;"]]]]]],"~$remove-node",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",56,"^C",7,"^D",56,"^E",18,"^F",["^G",["^H",["^G",[["^I","^J"]]]]]],"^5","~$viz.forest/remove-node","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",18,"^L",["^G",[["^I","^J"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",56,"^P","^Q","^D",56,"^R",2,"^S",true,"^F",["^G",["^H",["^G",[["^I","^J"]]]]]],"~$spawn-child",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",81,"^C",7,"^D",81,"^E",18,"^F",["^G",["^H",["^G",[["^I","^10","^W"]]]]]],"^5","~$viz.forest/spawn-child","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",18,"^L",["^G",[["^I","^10","^W"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",81,"^P","^Y","^D",81,"^R",3,"^S",true,"^F",["^G",["^H",["^G",[["^I","^10","^W"]]]]]],"~$lines",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",95,"^C",7,"^D",95,"^E",12,"^F",["^G",["^H",["^G",[["^I"]]]]]],"^5","~$viz.forest/lines","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",12,"^L",["^G",[["^I"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",95,"^P","^Q","^D",95,"^R",1,"^S",true,"^F",["^G",["^H",["^G",[["^I"]]]]]],"~$unset-parent",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",17,"^C",8,"^D",17,"^E",20,"^[",true,"^F",["^G",["^H",["^G",[["^I","^J","^10"]]]]]],"^[",true,"^5","~$viz.forest/unset-parent","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",20,"^L",["^G",[["^I","^J","^10"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",17,"^P","^Q","^D",17,"^R",3,"^S",true,"^F",["^G",["^H",["^G",[["^I","^J","^10"]]]]]],"~$roots",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",89,"^C",7,"^D",89,"^E",12,"^F",["^G",["^H",["^G",[["^I"]]]]]],"^5","~$viz.forest/roots","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",12,"^L",["^G",[["^I"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",89,"^P",["^4",["~$cljs.core/ValSeq","~$clj-nil"]],"^D",89,"^R",1,"^S",true,"^F",["^G",["^H",["^G",[["^I"]]]]]],"~$leaves",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",92,"^C",7,"^D",92,"^E",13,"^F",["^G",["^H",["^G",[["^I"]]]]]],"^5","~$viz.forest/leaves","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",13,"^L",["^G",[["^I"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",92,"^P",["^4",["^1H","^1I"]],"^D",92,"^R",1,"^S",true,"^F",["^G",["^H",["^G",[["^I"]]]]]],"~$update-node-meta",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",72,"^C",7,"^D",72,"^E",23,"^F",["^G",["^H",["^G",[["^I","^J","~$f"]]]]]],"^5","~$viz.forest/update-node-meta","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",23,"^L",["^G",[["^I","^J","~$f"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",72,"^P","^Q","^D",72,"^R",3,"^S",true,"^F",["^G",["^H",["^G",[["^I","^J","~$f"]]]]]],"~$leaf?",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",93,"^C",7,"^D",93,"^E",12,"^F",["^G",["^H",["^G",[["^15"]]]]]],"^5","~$viz.forest/leaf?","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",12,"^L",["^G",[["^15"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",93,"^P","^17","^D",93,"^R",1,"^S",true,"^F",["^G",["^H",["^G",[["^15"]]]]]],"~$node-at-pos?",["^ ","^?",null,"^@",["^ ","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^B",39,"^C",7,"^D",39,"^E",19,"^F",["^G",["^H",["^G",[["^I","^W"]]]]]],"^5","~$viz.forest/node-at-pos?","^A","/home/mediocregopher/src/viz/src/viz/forest.cljs","^E",19,"^L",["^G",[["^I","^W"]]],"^M",null,"^N",["^G",[null,null]],"^C",1,"^O",false,"^B",39,"^P","^17","^D",39,"^R",2,"^S",true,"^F",["^G",["^H",["^G",[["^I","^W"]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["^@","~:next-id","~:grid","~:parent-pos","~:pos","~:roots","~:leaves","~:nodes","~:id","~:parent-id","~:child-ids"]],"~:order",["^1W","^20","^1Z","^1[","^1V","^22","^1X","^23","^1Y","^21","^@"]],"~:doc",null]
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/forest.js b/static/src/assets/viz/2/viz/forest.js new file mode 100644 index 0000000..4481c7d --- /dev/null +++ b/static/src/assets/viz/2/viz/forest.js @@ -0,0 +1,109 @@ +// Compiled by ClojureScript 1.10.439 {} +goog.provide('viz.forest'); +goog.require('cljs.core'); +goog.require('viz.grid'); +viz.forest.new_forest = (function viz$forest$new_forest(grid_def){ +return new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"grid","grid",402978600),viz.grid.new_grid.call(null,grid_def),new cljs.core.Keyword(null,"nodes","nodes",-2099585805),cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"roots","roots",-1088919250),cljs.core.PersistentHashSet.EMPTY,new cljs.core.Keyword(null,"leaves","leaves",-2143630574),cljs.core.PersistentHashSet.EMPTY,new cljs.core.Keyword(null,"next-id","next-id",-224240762),(0)], null); +}); +viz.forest.new_id = (function viz$forest$new_id(forest){ +var id = new cljs.core.Keyword(null,"next-id","next-id",-224240762).cljs$core$IFn$_invoke$arity$1(forest); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.assoc.call(null,forest,new cljs.core.Keyword(null,"next-id","next-id",-224240762),(id + (1))),id], null); +}); +viz.forest.unset_parent = (function viz$forest$unset_parent(forest,id,parent_id){ +return cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,forest,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id], null),cljs.core.dissoc,new cljs.core.Keyword(null,"parent-id","parent-id",-1400729131),new cljs.core.Keyword(null,"parent-pos","parent-pos",-282368566)),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),parent_id,new cljs.core.Keyword(null,"child-ids","child-ids",-604525861)], null),cljs.core.disj,id),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"roots","roots",-1088919250)], null),cljs.core.conj,id),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"leaves","leaves",-2143630574)], null),cljs.core.conj,parent_id); +}); +viz.forest.set_parent = (function viz$forest$set_parent(forest,id,parent_id){ +var parent_pos = cljs.core.get_in.call(null,forest,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),parent_id,new cljs.core.Keyword(null,"pos","pos",-864607220)], null)); +var prev_parent_id = cljs.core.get_in.call(null,forest,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id,new cljs.core.Keyword(null,"parent-id","parent-id",-1400729131)], null)); +return ((function (parent_pos,prev_parent_id){ +return (function (p1__10848_SHARP_){ +if(cljs.core.truth_(prev_parent_id)){ +return viz.forest.unset_parent.call(null,p1__10848_SHARP_,id,prev_parent_id); +} else { +return p1__10848_SHARP_; +} +});})(parent_pos,prev_parent_id)) +.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.assoc_in.call(null,cljs.core.assoc_in.call(null,forest,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id,new cljs.core.Keyword(null,"parent-id","parent-id",-1400729131)], null),parent_id),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id,new cljs.core.Keyword(null,"parent-pos","parent-pos",-282368566)], null),parent_pos),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),parent_id,new cljs.core.Keyword(null,"child-ids","child-ids",-604525861)], null),((function (parent_pos,prev_parent_id){ +return (function (p1__10847_SHARP_){ +if(cljs.core.truth_(p1__10847_SHARP_)){ +return cljs.core.conj.call(null,p1__10847_SHARP_,id); +} else { +return cljs.core.PersistentHashSet.createAsIfByAssoc([id]); +} +});})(parent_pos,prev_parent_id)) +),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"roots","roots",-1088919250)], null),cljs.core.disj,id),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"leaves","leaves",-2143630574)], null),cljs.core.disj,parent_id)); +}); +viz.forest.node_at_pos_QMARK_ = (function viz$forest$node_at_pos_QMARK_(forest,pos){ +return cljs.core.boolean$.call(null,cljs.core.some.call(null,(function (p1__10849_SHARP_){ +return cljs.core._EQ_.call(null,pos,new cljs.core.Keyword(null,"pos","pos",-864607220).cljs$core$IFn$_invoke$arity$1(p1__10849_SHARP_)); +}),cljs.core.vals.call(null,new cljs.core.Keyword(null,"nodes","nodes",-2099585805).cljs$core$IFn$_invoke$arity$1(forest)))); +}); +viz.forest.empty_adjacent_points = (function viz$forest$empty_adjacent_points(forest,pos){ +return viz.grid.empty_adjacent_points.call(null,new cljs.core.Keyword(null,"grid","grid",402978600).cljs$core$IFn$_invoke$arity$1(forest),pos); +}); +viz.forest.add_node = (function viz$forest$add_node(forest,pos){ +var vec__10850 = viz.forest.new_id.call(null,forest); +var forest__$1 = cljs.core.nth.call(null,vec__10850,(0),null); +var id = cljs.core.nth.call(null,vec__10850,(1),null); +var forest__$2 = cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.assoc_in.call(null,cljs.core.update_in.call(null,forest__$1,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"grid","grid",402978600)], null),viz.grid.add_point,pos),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id], null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"id","id",-1388402092),id,new cljs.core.Keyword(null,"pos","pos",-864607220),pos], null)),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"roots","roots",-1088919250)], null),cljs.core.conj,id),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"leaves","leaves",-2143630574)], null),cljs.core.conj,id); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [forest__$2,id], null); +}); +viz.forest.remove_node = (function viz$forest$remove_node(forest,id){ +var node = cljs.core.get_in.call(null,forest,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id], null)); +var child_ids = new cljs.core.Keyword(null,"child-ids","child-ids",-604525861).cljs$core$IFn$_invoke$arity$1(node); +var parent_id = new cljs.core.Keyword(null,"parent-id","parent-id",-1400729131).cljs$core$IFn$_invoke$arity$1(node); +return cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,((function (node,child_ids,parent_id){ +return (function (forest__$1){ +return cljs.core.reduce.call(null,((function (node,child_ids,parent_id){ +return (function (p1__10854_SHARP_,p2__10855_SHARP_){ +return viz.forest.unset_parent.call(null,p1__10854_SHARP_,p2__10855_SHARP_,id); +});})(node,child_ids,parent_id)) +,forest__$1,child_ids); +});})(node,child_ids,parent_id)) +.call(null,((function (node,child_ids,parent_id){ +return (function (p1__10853_SHARP_){ +if(cljs.core.truth_(parent_id)){ +return viz.forest.unset_parent.call(null,p1__10853_SHARP_,id,parent_id); +} else { +return p1__10853_SHARP_; +} +});})(node,child_ids,parent_id)) +.call(null,cljs.core.update_in.call(null,forest,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"grid","grid",402978600)], null),viz.grid.rm_point,new cljs.core.Keyword(null,"pos","pos",-864607220).cljs$core$IFn$_invoke$arity$1(node)))),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805)], null),cljs.core.dissoc,id),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"roots","roots",-1088919250)], null),cljs.core.disj,id),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"leaves","leaves",-2143630574)], null),cljs.core.disj,id); +}); +viz.forest.update_node_meta = (function viz$forest$update_node_meta(forest,id,f){ +return cljs.core.update_in.call(null,forest,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id,new cljs.core.Keyword(null,"meta","meta",1499536964)], null),f); +}); +viz.forest.get_node_meta = (function viz$forest$get_node_meta(forest,id){ +return cljs.core.get_in.call(null,forest,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id,new cljs.core.Keyword(null,"meta","meta",1499536964)], null)); +}); +viz.forest.get_node = (function viz$forest$get_node(forest,id){ +return cljs.core.get_in.call(null,forest,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nodes","nodes",-2099585805),id], null)); +}); +viz.forest.spawn_child = (function viz$forest$spawn_child(forest,parent_id,pos){ +var vec__10856 = viz.forest.add_node.call(null,forest,pos); +var forest__$1 = cljs.core.nth.call(null,vec__10856,(0),null); +var id = cljs.core.nth.call(null,vec__10856,(1),null); +var forest__$2 = viz.forest.set_parent.call(null,forest__$1,id,parent_id); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [forest__$2,id], null); +}); +viz.forest.roots = (function viz$forest$roots(forest){ +return cljs.core.vals.call(null,cljs.core.select_keys.call(null,new cljs.core.Keyword(null,"nodes","nodes",-2099585805).cljs$core$IFn$_invoke$arity$1(forest),new cljs.core.Keyword(null,"roots","roots",-1088919250).cljs$core$IFn$_invoke$arity$1(forest))); +}); +viz.forest.root_QMARK_ = (function viz$forest$root_QMARK_(node){ +return (!(cljs.core.boolean$.call(null,new cljs.core.Keyword(null,"parent-id","parent-id",-1400729131).cljs$core$IFn$_invoke$arity$1(node)))); +}); +viz.forest.leaves = (function viz$forest$leaves(forest){ +return cljs.core.vals.call(null,cljs.core.select_keys.call(null,new cljs.core.Keyword(null,"nodes","nodes",-2099585805).cljs$core$IFn$_invoke$arity$1(forest),new cljs.core.Keyword(null,"leaves","leaves",-2143630574).cljs$core$IFn$_invoke$arity$1(forest))); +}); +viz.forest.leaf_QMARK_ = (function viz$forest$leaf_QMARK_(node){ +return cljs.core.empty_QMARK_.call(null,new cljs.core.Keyword(null,"child-ids","child-ids",-604525861).cljs$core$IFn$_invoke$arity$1(node)); +}); +viz.forest.lines = (function viz$forest$lines(forest){ +return cljs.core.map.call(null,(function (p1__10860_SHARP_){ +return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"pos","pos",-864607220).cljs$core$IFn$_invoke$arity$1(p1__10860_SHARP_),new cljs.core.Keyword(null,"parent-pos","parent-pos",-282368566).cljs$core$IFn$_invoke$arity$1(p1__10860_SHARP_)],null)); +}),cljs.core.remove.call(null,(function (p1__10859_SHARP_){ +return cljs.core.empty_QMARK_.call(null,new cljs.core.Keyword(null,"parent-pos","parent-pos",-282368566).cljs$core$IFn$_invoke$arity$1(p1__10859_SHARP_)); +}),cljs.core.vals.call(null,new cljs.core.Keyword(null,"nodes","nodes",-2099585805).cljs$core$IFn$_invoke$arity$1(forest)))); +}); + +//# sourceMappingURL=forest.js.map diff --git a/static/src/assets/viz/2/viz/forest.js.map b/static/src/assets/viz/2/viz/forest.js.map new file mode 100644 index 0000000..5d1245b --- /dev/null +++ b/static/src/assets/viz/2/viz/forest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/viz\/forest.js","sources":["forest.cljs"],"lineCount":109,"mappings":";AAAA;;;AAIA,wBAAA,xBAAMA,wDAAY;AAAlB,AAAA,kDAAA,0FAAA,wDAAA,mCAAA,wDAAA,kCAAA,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AAUoC;;AAEtC,2BAAA,3BAAMC,8DAAe,OAAO;AAA5B,AACE,yCAAA,mFAAA,2DAAA,hLAAC7B,2BAAOV,kJAAeE;;AAEzB,sBAAA,tBAAMsC,oDAAU,OAAO;AAAvB,AACE,yCAAA,mFAAA,rHAAC9B,2BAAOV,kJAAeE;;AAEzB,yBAAA,zBAAMuC,0DAAa,OAAO,UAAU;AAApC,AACE,IAAA,aAAkB,AAAChB,8BAASzB,OAAOoB;iBAAnC,AAAAM,wBAAAgB,WAAA,IAAA,pDAAO;SAAP,AAAAhB,wBAAAgB,WAAA,IAAA,5CAAc;IACR,6CAAW1C,hCACA,AAACS,2CAAWP,GAAGI;AAFhC,AAAA,0FAKGN,WAAOE;;AAEZ,mBAAA,nBAAMyC,8CAAO;AAAb,sJAAyB3C,tHAAc,gCAAA,AAAA,hCAAC4C,8HAAY,AAAA,sFAAQ5C,pPAAS,OAACsB;;AACtE,yBAAA,zBAAMuB,0DAAO;AAAb,AAAmB,UAAK,AAAC5B,6BAAQ,AAAA,8FAAYa;;AAE7C,oBAAA,pBAAMgB,gDAAQ;AAAd,sJAA0B9C,tHAAc,gCAAA,AAAA,hCAAC4C,8HAAY,AAAA,wFAAS5C,tPAAS,OAACsB;;AACxE,yBAAA,zBAAMyB,0DAAO;AAAb,AAAmB,OAACC,iCAAO,AAAA,6FAAYlB;;AAEvC,mBAAA,nBAAMmB,8CAAO;AAAb,AAKO,+BAAA,WAAA,nCAACG;AAAD,AAAM,YAAAC,2BAAA,KAAA,EAAA,IAAA,AAAAA,sCAAA,sNAAA,rNAAQ,AAAA,iFAAAC,kBAAS,AAAA,+FAAAA;GADvB,2BAAA,WAAA,tCAACJ;AAAD,AAAS,OAACF,iCAAO,AAAA,+FAAAG;kHAHjBnD,tFACA,AAAA,zBACA,AAACsB","names":["viz.forest\/new-forest","viz.grid\/new-grid","grid-def","viz.forest\/new-id","forest","cljs.core\/assoc","id","viz.forest\/unset-parent","cljs.core\/update-in","cljs.core\/dissoc","parent-id","cljs.core\/disj","cljs.core\/conj","viz.forest\/set-parent","cljs.core\/get-in","cljs.core\/assoc-in","parent-pos","p1__10847#","p1__10848#","prev-parent-id","viz.forest\/node-at-pos?","cljs.core\/boolean","cljs.core\/some","cljs.core\/=","pos","p1__10849#","cljs.core\/vals","viz.forest\/empty-adjacent-points","viz.grid\/empty-adjacent-points","viz.forest\/add-node","cljs.core\/nth","vec__10850","viz.grid\/add-point","viz.forest\/remove-node","node","viz.grid\/rm-point","p1__10853#","cljs.core\/reduce","p1__10854#","p2__10855#","child-ids","viz.forest\/update-node-meta","f","viz.forest\/get-node-meta","viz.forest\/get-node","viz.forest\/spawn-child","vec__10856","viz.forest\/roots","cljs.core\/select-keys","viz.forest\/root?","viz.forest\/leaves","viz.forest\/leaf?","cljs.core\/empty?","viz.forest\/lines","cljs.core\/remove","p1__10859#","cljs.core\/map","cljs.core\/PersistentVector","p1__10860#"]}
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/ghost.cljs b/static/src/assets/viz/2/viz/ghost.cljs new file mode 100644 index 0000000..d468479 --- /dev/null +++ b/static/src/assets/viz/2/viz/ghost.cljs @@ -0,0 +1,49 @@ +(ns viz.ghost + (:require [quil.core :as q] + [quil.middleware :as m] + [viz.forest :as forest] + [viz.grid :as grid] + clojure.set)) + +(defn new-ghost [] + {:active-node-ids #{} + :color 0xFF000000 + }) + +(defn add-active-node [ghost id] + (update-in ghost [:active-node-ids] conj id)) + +(defn rm-active-node [ghost id] + (update-in ghost [:active-node-ids] disj id)) + +(defn- gen-new-poss [forest poss-fn id] + "generates new positions branching from the given node" + (let [pos (:pos (forest/get-node forest id)) + adj-poss (forest/empty-adjacent-points forest pos) + new-poss (poss-fn pos adj-poss)] + new-poss)) + +(defn- spawn-children [forest poss-fn id] + (reduce (fn [[forest new-ids] pos] + (let [[forest new-id] (forest/spawn-child forest id pos)] + [forest (conj new-ids new-id)])) + [forest #{}] + (gen-new-poss forest poss-fn id))) + +(defn- spawn-children-multi [forest poss-fn ids] + (reduce (fn [[forest new-ids] id] + (let [[forest this-new-ids] (spawn-children forest poss-fn id)] + [forest (clojure.set/union new-ids this-new-ids)])) + [forest #{}] + ids)) + +(defn incr [ghost forest poss-fn] + (let [[forest new-ids] (spawn-children-multi forest poss-fn (:active-node-ids ghost))] + [(assoc ghost :active-node-ids new-ids) + (reduce (fn [forest id] + (forest/update-node-meta forest id + (fn [m] (assoc m :color (:color ghost))))) + forest new-ids)])) + +(defn- eg-poss-fn [pos adj-poss] + (take 2 (random-sample 0.6 adj-poss))) diff --git a/static/src/assets/viz/2/viz/ghost.cljs.cache.json b/static/src/assets/viz/2/viz/ghost.cljs.cache.json new file mode 100644 index 0000000..15e7065 --- /dev/null +++ b/static/src/assets/viz/2/viz/ghost.cljs.cache.json @@ -0,0 +1 @@ +["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$viz.ghost","~:imports",null,"~:requires",["^ ","~$q","~$quil.core","^9","^9","~$m","~$quil.middleware","^:","^:","~$forest","~$viz.forest","^<","^<","~$grid","~$viz.grid","^>","^>","~$clojure.set","^?"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$new-ghost",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/home/mediocregopher/src/viz/src/viz/ghost.cljs","~:line",8,"~:column",7,"~:end-line",8,"~:end-column",16,"~:arglists",["~#list",["~$quote",["^L",[[]]]]]],"^5","~$viz.ghost/new-ghost","^F","src/viz/ghost.cljs","^J",16,"~:method-params",["^L",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^L",[null,null]],"^H",1,"~:variadic?",false,"^G",8,"~:ret-tag","~$cljs.core/IMap","^I",8,"~:max-fixed-arity",0,"~:fn-var",true,"^K",["^L",["^M",["^L",[[]]]]]],"~$add-active-node",["^ ","^D",null,"^E",["^ ","^F","/home/mediocregopher/src/viz/src/viz/ghost.cljs","^G",13,"^H",7,"^I",13,"^J",22,"^K",["^L",["^M",["^L",[["~$ghost","~$id"]]]]]],"^5","~$viz.ghost/add-active-node","^F","src/viz/ghost.cljs","^J",22,"^O",["^L",[["^X","^Y"]]],"^P",null,"^Q",["^L",[null,null]],"^H",1,"^R",false,"^G",13,"^S","~$any","^I",13,"^U",2,"^V",true,"^K",["^L",["^M",["^L",[["^X","^Y"]]]]]],"~$rm-active-node",["^ ","^D",null,"^E",["^ ","^F","/home/mediocregopher/src/viz/src/viz/ghost.cljs","^G",16,"^H",7,"^I",16,"^J",21,"^K",["^L",["^M",["^L",[["^X","^Y"]]]]]],"^5","~$viz.ghost/rm-active-node","^F","src/viz/ghost.cljs","^J",21,"^O",["^L",[["^X","^Y"]]],"^P",null,"^Q",["^L",[null,null]],"^H",1,"^R",false,"^G",16,"^S","^[","^I",16,"^U",2,"^V",true,"^K",["^L",["^M",["^L",[["^X","^Y"]]]]]],"~$gen-new-poss",["^ ","^D",null,"^E",["^ ","^F","/home/mediocregopher/src/viz/src/viz/ghost.cljs","^G",19,"^H",8,"^I",19,"^J",20,"~:private",true,"^K",["^L",["^M",["^L",[["^;","~$poss-fn","^Y"]]]]]],"^13",true,"^5","~$viz.ghost/gen-new-poss","^F","src/viz/ghost.cljs","^J",20,"^O",["^L",[["^;","^14","^Y"]]],"^P",null,"^Q",["^L",[null,null]],"^H",1,"^R",false,"^G",19,"^S","^[","^I",19,"^U",3,"^V",true,"^K",["^L",["^M",["^L",[["^;","^14","^Y"]]]]]],"~$spawn-children",["^ ","^D",null,"^E",["^ ","^F","/home/mediocregopher/src/viz/src/viz/ghost.cljs","^G",26,"^H",8,"^I",26,"^J",22,"^13",true,"^K",["^L",["^M",["^L",[["^;","^14","^Y"]]]]]],"^13",true,"^5","~$viz.ghost/spawn-children","^F","src/viz/ghost.cljs","^J",22,"^O",["^L",[["^;","^14","^Y"]]],"^P",null,"^Q",["^L",[null,null]],"^H",1,"^R",false,"^G",26,"^S","^[","^I",26,"^U",3,"^V",true,"^K",["^L",["^M",["^L",[["^;","^14","^Y"]]]]]],"~$spawn-children-multi",["^ ","^D",null,"^E",["^ ","^F","/home/mediocregopher/src/viz/src/viz/ghost.cljs","^G",33,"^H",8,"^I",33,"^J",28,"^13",true,"^K",["^L",["^M",["^L",[["^;","^14","~$ids"]]]]]],"^13",true,"^5","~$viz.ghost/spawn-children-multi","^F","src/viz/ghost.cljs","^J",28,"^O",["^L",[["^;","^14","^19"]]],"^P",null,"^Q",["^L",[null,null]],"^H",1,"^R",false,"^G",33,"^S","^[","^I",33,"^U",3,"^V",true,"^K",["^L",["^M",["^L",[["^;","^14","^19"]]]]]],"~$incr",["^ ","^D",null,"^E",["^ ","^F","/home/mediocregopher/src/viz/src/viz/ghost.cljs","^G",40,"^H",7,"^I",40,"^J",11,"^K",["^L",["^M",["^L",[["^X","^;","^14"]]]]]],"^5","~$viz.ghost/incr","^F","src/viz/ghost.cljs","^J",11,"^O",["^L",[["^X","^;","^14"]]],"^P",null,"^Q",["^L",[null,null]],"^H",1,"^R",false,"^G",40,"^S","~$cljs.core/IVector","^I",40,"^U",3,"^V",true,"^K",["^L",["^M",["^L",[["^X","^;","^14"]]]]]],"~$eg-poss-fn",["^ ","^D",null,"^E",["^ ","^F","/home/mediocregopher/src/viz/src/viz/ghost.cljs","^G",48,"^H",8,"^I",48,"^J",18,"^13",true,"^K",["^L",["^M",["^L",[["~$pos","~$adj-poss"]]]]]],"^13",true,"^5","~$viz.ghost/eg-poss-fn","^F","src/viz/ghost.cljs","^J",18,"^O",["^L",[["^1?","^1@"]]],"^P",null,"^Q",["^L",[null,null]],"^H",1,"^R",false,"^G",48,"^S","^[","^I",48,"^U",2,"^V",true,"^K",["^L",["^M",["^L",[["^1?","^1@"]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:active-node-ids","~:color","~:pos"]],"~:order",["^1F","^1G","^1H"]],"~:doc",null]
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/ghost.js b/static/src/assets/viz/2/viz/ghost.js new file mode 100644 index 0000000..d2106e1 --- /dev/null +++ b/static/src/assets/viz/2/viz/ghost.js @@ -0,0 +1,65 @@ +// Compiled by ClojureScript 1.10.439 {} +goog.provide('viz.ghost'); +goog.require('cljs.core'); +goog.require('quil.core'); +goog.require('quil.middleware'); +goog.require('viz.forest'); +goog.require('viz.grid'); +goog.require('clojure.set'); +viz.ghost.new_ghost = (function viz$ghost$new_ghost(){ +return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751),cljs.core.PersistentHashSet.EMPTY,new cljs.core.Keyword(null,"color","color",1011675173),(4278190080)], null); +}); +viz.ghost.add_active_node = (function viz$ghost$add_active_node(ghost,id){ +return cljs.core.update_in.call(null,ghost,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751)], null),cljs.core.conj,id); +}); +viz.ghost.rm_active_node = (function viz$ghost$rm_active_node(ghost,id){ +return cljs.core.update_in.call(null,ghost,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751)], null),cljs.core.disj,id); +}); +viz.ghost.gen_new_poss = (function viz$ghost$gen_new_poss(forest,poss_fn,id){ + +var pos = new cljs.core.Keyword(null,"pos","pos",-864607220).cljs$core$IFn$_invoke$arity$1(viz.forest.get_node.call(null,forest,id)); +var adj_poss = viz.forest.empty_adjacent_points.call(null,forest,pos); +var new_poss = poss_fn.call(null,pos,adj_poss); +return new_poss; +}); +viz.ghost.spawn_children = (function viz$ghost$spawn_children(forest,poss_fn,id){ +return cljs.core.reduce.call(null,(function (p__10863,pos){ +var vec__10864 = p__10863; +var forest__$1 = cljs.core.nth.call(null,vec__10864,(0),null); +var new_ids = cljs.core.nth.call(null,vec__10864,(1),null); +var vec__10867 = viz.forest.spawn_child.call(null,forest__$1,id,pos); +var forest__$2 = cljs.core.nth.call(null,vec__10867,(0),null); +var new_id = cljs.core.nth.call(null,vec__10867,(1),null); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [forest__$2,cljs.core.conj.call(null,new_ids,new_id)], null); +}),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [forest,cljs.core.PersistentHashSet.EMPTY], null),viz.ghost.gen_new_poss.call(null,forest,poss_fn,id)); +}); +viz.ghost.spawn_children_multi = (function viz$ghost$spawn_children_multi(forest,poss_fn,ids){ +return cljs.core.reduce.call(null,(function (p__10870,id){ +var vec__10871 = p__10870; +var forest__$1 = cljs.core.nth.call(null,vec__10871,(0),null); +var new_ids = cljs.core.nth.call(null,vec__10871,(1),null); +var vec__10874 = viz.ghost.spawn_children.call(null,forest__$1,poss_fn,id); +var forest__$2 = cljs.core.nth.call(null,vec__10874,(0),null); +var this_new_ids = cljs.core.nth.call(null,vec__10874,(1),null); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [forest__$2,clojure.set.union.call(null,new_ids,this_new_ids)], null); +}),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [forest,cljs.core.PersistentHashSet.EMPTY], null),ids); +}); +viz.ghost.incr = (function viz$ghost$incr(ghost,forest,poss_fn){ +var vec__10877 = viz.ghost.spawn_children_multi.call(null,forest,poss_fn,new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751).cljs$core$IFn$_invoke$arity$1(ghost)); +var forest__$1 = cljs.core.nth.call(null,vec__10877,(0),null); +var new_ids = cljs.core.nth.call(null,vec__10877,(1),null); +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.assoc.call(null,ghost,new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751),new_ids),cljs.core.reduce.call(null,((function (vec__10877,forest__$1,new_ids){ +return (function (forest__$2,id){ +return viz.forest.update_node_meta.call(null,forest__$2,id,((function (vec__10877,forest__$1,new_ids){ +return (function (m){ +return cljs.core.assoc.call(null,m,new cljs.core.Keyword(null,"color","color",1011675173),new cljs.core.Keyword(null,"color","color",1011675173).cljs$core$IFn$_invoke$arity$1(ghost)); +});})(vec__10877,forest__$1,new_ids)) +); +});})(vec__10877,forest__$1,new_ids)) +,forest__$1,new_ids)], null); +}); +viz.ghost.eg_poss_fn = (function viz$ghost$eg_poss_fn(pos,adj_poss){ +return cljs.core.take.call(null,(2),cljs.core.random_sample.call(null,0.6,adj_poss)); +}); + +//# sourceMappingURL=ghost.js.map diff --git a/static/src/assets/viz/2/viz/ghost.js.map b/static/src/assets/viz/2/viz/ghost.js.map new file mode 100644 index 0000000..a2b7533 --- /dev/null +++ b/static/src/assets/viz/2/viz/ghost.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/viz\/ghost.js","sources":["ghost.cljs"],"lineCount":65,"mappings":";AAAA;;;;;;;AAOA,sBAAA,tBAAMA;AAAN,AAAA,kDAAA,2EAAA,kCAAA,uDAAA;;AAKA,4BAAA,5BAAMC,gEAAiB,MAAM;AAA7B,AACE,2CAAA,mFAAA,vHAACC,8BAAUC,4KAAyBC,eAAKC;;AAE3C,2BAAA,3BAAMC,8DAAgB,MAAM;AAA5B,AACE,2CAAA,mFAAA,vHAACJ,8BAAUC,4KAAyBI,eAAKF;;AAE3C,yBAAA,zBAAOG,0DAAc,OAAO,QAAQ;AAApC,AAAA;AAEE,IAAM,MAAI,AAAA,iFAAM,AAACC,8BAAgBC,OAAOL;IAClC,WAAS,AAACM,2CAA6BD,OAAOE;IAC9C,WAAS,AAACC,kBAAQD,IAAIE;AAF5B,AAGEC;;AAEJ,2BAAA,3BAAOC,8DAAgB,OAAO,QAAQ;AAAtC,AACE,OAACC,2BAAO,WAAA,SAAsB;AAAtB,AAAA,IAAA,aAAAC;iBAAA,AAAAC,wBAAAC,WAAA,I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z.ghost\/new-ghost","viz.ghost\/add-active-node","cljs.core\/update-in","ghost","cljs.core\/conj","id","viz.ghost\/rm-active-node","cljs.core\/disj","viz.ghost\/gen-new-poss","viz.forest\/get-node","forest","viz.forest\/empty-adjacent-points","pos","poss-fn","adj-poss","new-poss","viz.ghost\/spawn-children","cljs.core\/reduce","p__10863","cljs.core\/nth","vec__10864","vec__10867","viz.forest\/spawn-child","new-ids","new-id","viz.ghost\/spawn-children-multi","p__10870","vec__10871","vec__10874","clojure.set\/union","this-new-ids","ids","viz.ghost\/incr","vec__10877","cljs.core\/assoc","viz.forest\/update-node-meta","m","viz.ghost\/eg-poss-fn","cljs.core\/take","cljs.core\/random-sample"]}
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/grid.cljs b/static/src/assets/viz/2/viz/grid.cljs new file mode 100644 index 0000000..6e31443 --- /dev/null +++ b/static/src/assets/viz/2/viz/grid.cljs @@ -0,0 +1,63 @@ +(ns viz.grid) + +;; grid set of points relative to a common origin + +(def euclidean [ [0 -1] + [-1 0] , [1 0] + [0 1] ]) + +(def isometric [[-1 -1] [0 -2] [1 -1] + , + [-1 1] [0 2] [1 1]]) + +(def hexagonal [ [0 -1] + , + [-1 1] [1 1]]) + +(defn new-grid [grid-def] + { :grid-def grid-def + :points #{} }) + +(defn add-point [grid point] + (update-in grid [:points] conj point)) + +(def my-grid (-> (new-grid euclidean) + (add-point [0 1]))) + +;; TODO this could be useful, but it's not needed now, as long as all points we +;; use are generated from adjacent-points +;;(defn valid-point? [grid point] +;; (letfn [(ordered-dim-points [dim order] +;; (->> (:grid-def grid) +;; (map #(%1 dim)) +;; (sort (if (= order :asc) < > )) +;; (filter (if (= order :asc) #(> %1 0) #(< %1 0))) +;; )) +;; (closest-in-dim [dim-i dim-jj] +;; (reduce (fn [curr dim-j] +;; (let [next (+ curr dim-j)] +;; (reduce #(if (= ;; TODO wat +;; (if (> 0 dim-i) +;; (min dim-i next) +;; (max dim-i next)))) +;; 0 dim-jj)) +;; +;; ] +;; (closest-in-dim 4 [1]))) +;; ;;(ordered-dim 1 :asc))) +;; +;;(valid-point? my-grid [0 1]) + +(defn rm-point [grid point] + (update-in grid [:points] disj point)) + +(defn adjacent-points [grid point] + (map #(map + %1 point) (:grid-def grid))) + +(defn empty-adjacent-points [grid point] + (remove (:points grid) (adjacent-points grid point))) + +(-> (new-grid isometric) + (add-point [0 0]) + (add-point [0 1]) + (empty-adjacent-points [0 1])) diff --git a/static/src/assets/viz/2/viz/grid.cljs.cache.json b/static/src/assets/viz/2/viz/grid.cljs.cache.json new file mode 100644 index 0000000..fcc5225 --- /dev/null +++ b/static/src/assets/viz/2/viz/grid.cljs.cache.json @@ -0,0 +1 @@ +["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$viz.grid","~:imports",null,"~:requires",null,"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$euclidean",["^ ","^5","~$viz.grid/euclidean","~:file","src/viz/grid.cljs","~:line",5,"~:column",1,"~:end-line",5,"~:end-column",15,"~:meta",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",5,"^@",6,"^A",5,"^B",15],"~:tag","~$cljs.core/IVector"],"~$isometric",["^ ","^5","~$viz.grid/isometric","^>","src/viz/grid.cljs","^?",9,"^@",1,"^A",9,"^B",15,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",9,"^@",6,"^A",9,"^B",15],"^D","^E"],"~$hexagonal",["^ ","^5","~$viz.grid/hexagonal","^>","src/viz/grid.cljs","^?",13,"^@",1,"^A",13,"^B",15,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",13,"^@",6,"^A",13,"^B",15],"^D","^E"],"~$new-grid",["^ ","~:protocol-inline",null,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",17,"^@",7,"^A",17,"^B",15,"~:arglists",["~#list",["~$quote",["^M",[["~$grid-def"]]]]]],"^5","~$viz.grid/new-grid","^>","src/viz/grid.cljs","^B",15,"~:method-params",["^M",[["^O"]]],"~:protocol-impl",null,"~:arglists-meta",["^M",[null,null]],"^@",1,"~:variadic?",false,"^?",17,"~:ret-tag","~$cljs.core/IMap","^A",17,"~:max-fixed-arity",1,"~:fn-var",true,"^L",["^M",["^N",["^M",[["^O"]]]]]],"~$add-point",["^ ","^K",null,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",21,"^@",7,"^A",21,"^B",16,"^L",["^M",["^N",["^M",[["~$grid","~$point"]]]]]],"^5","~$viz.grid/add-point","^>","src/viz/grid.cljs","^B",16,"^Q",["^M",[["^Z","^["]]],"^R",null,"^S",["^M",[null,null]],"^@",1,"^T",false,"^?",21,"^U","~$any","^A",21,"^W",2,"^X",true,"^L",["^M",["^N",["^M",[["^Z","^["]]]]]],"~$my-grid",["^ ","^5","~$viz.grid/my-grid","^>","src/viz/grid.cljs","^?",24,"^@",1,"^A",24,"^B",13,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",24,"^@",6,"^A",24,"^B",13],"^D","^11"],"~$rm-point",["^ ","^K",null,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",51,"^@",7,"^A",51,"^B",15,"^L",["^M",["^N",["^M",[["^Z","^["]]]]]],"^5","~$viz.grid/rm-point","^>","src/viz/grid.cljs","^B",15,"^Q",["^M",[["^Z","^["]]],"^R",null,"^S",["^M",[null,null]],"^@",1,"^T",false,"^?",51,"^U","^11","^A",51,"^W",2,"^X",true,"^L",["^M",["^N",["^M",[["^Z","^["]]]]]],"~$adjacent-points",["^ ","^K",null,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",54,"^@",7,"^A",54,"^B",22,"^L",["^M",["^N",["^M",[["^Z","^["]]]]]],"^5","~$viz.grid/adjacent-points","^>","src/viz/grid.cljs","^B",22,"^Q",["^M",[["^Z","^["]]],"^R",null,"^S",["^M",[null,null]],"^@",1,"^T",false,"^?",54,"^U","^11","^A",54,"^W",2,"^X",true,"^L",["^M",["^N",["^M",[["^Z","^["]]]]]],"~$empty-adjacent-points",["^ ","^K",null,"^C",["^ ","^>","/home/mediocregopher/src/viz/src/viz/grid.cljs","^?",57,"^@",7,"^A",57,"^B",28,"^L",["^M",["^N",["^M",[["^Z","^["]]]]]],"^5","~$viz.grid/empty-adjacent-points","^>","src/viz/grid.cljs","^B",28,"^Q",["^M",[["^Z","^["]]],"^R",null,"^S",["^M",[null,null]],"^@",1,"^T",false,"^?",57,"^U","^11","^A",57,"^W",2,"^X",true,"^L",["^M",["^N",["^M",[["^Z","^["]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:grid-def","~:points"]],"~:order",["^1>","^1?"]],"~:doc",null]
\ No newline at end of file diff --git a/static/src/assets/viz/2/viz/grid.js b/static/src/assets/viz/2/viz/grid.js new file mode 100644 index 0000000..891193e --- /dev/null +++ b/static/src/assets/viz/2/viz/grid.js @@ -0,0 +1,27 @@ +// Compiled by ClojureScript 1.10.439 {} +goog.provide('viz.grid'); +goog.require('cljs.core'); +viz.grid.euclidean = new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(-1)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(-1),(0)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(1),(0)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(1)], null)], null); +viz.grid.isometric = new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(-1),(-1)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(-2)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(1),(-1)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(-1),(1)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(2)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(1),(1)], null)], null); +viz.grid.hexagonal = new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(-1)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(-1),(1)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(1),(1)], null)], null); +viz.grid.new_grid = (function viz$grid$new_grid(grid_def){ +return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"grid-def","grid-def",-392588768),grid_def,new cljs.core.Keyword(null,"points","points",-1486596883),cljs.core.PersistentHashSet.EMPTY], null); +}); +viz.grid.add_point = (function viz$grid$add_point(grid,point){ +return cljs.core.update_in.call(null,grid,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"points","points",-1486596883)], null),cljs.core.conj,point); +}); +viz.grid.my_grid = viz.grid.add_point.call(null,viz.grid.new_grid.call(null,viz.grid.euclidean),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(1)], null)); +viz.grid.rm_point = (function viz$grid$rm_point(grid,point){ +return cljs.core.update_in.call(null,grid,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"points","points",-1486596883)], null),cljs.core.disj,point); +}); +viz.grid.adjacent_points = (function viz$grid$adjacent_points(grid,point){ +return cljs.core.map.call(null,(function (p1__10844_SHARP_){ +return cljs.core.map.call(null,cljs.core._PLUS_,p1__10844_SHARP_,point); +}),new cljs.core.Keyword(null,"grid-def","grid-def",-392588768).cljs$core$IFn$_invoke$arity$1(grid)); +}); +viz.grid.empty_adjacent_points = (function viz$grid$empty_adjacent_points(grid,point){ +return cljs.core.remove.call(null,new cljs.core.Keyword(null,"points","points",-1486596883).cljs$core$IFn$_invoke$arity$1(grid),viz.grid.adjacent_points.call(null,grid,point)); +}); +viz.grid.empty_adjacent_points.call(null,viz.grid.add_point.call(null,viz.grid.add_point.call(null,viz.grid.new_grid.call(null,viz.grid.isometric),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(0)], null)),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(1)], null)),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(1)], null)); + +//# sourceMappingURL=grid.js.map diff --git a/static/src/assets/viz/2/viz/grid.js.map b/static/src/assets/viz/2/viz/grid.js.map new file mode 100644 index 0000000..1964511 --- /dev/null +++ b/static/src/assets/viz/2/viz/grid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/viz\/grid.js","sources":["grid.cljs"],"lineCount":27,"mappings":";AAAA;;AAIA,qBAAA,mFAAA,mFAAA,IAAA,aAAA,mFAAA,KAAA,YAAA,mFAAA,IAAA,YAAA,mFAAA,IAAA,1eAAKA;AAIL,qBAAA,mFAAA,mFAAA,KAAA,aAAA,mFAAA,IAAA,aAAA,mFAAA,IAAA,aAAA,mFAAA,KAAA,YAAA,mFAAA,IAAA,YAAA,mFAAA,IAAA,nrBAAKC;AAIL,qBAAA,mFAAA,mFAAA,IAAA,aAAA,mFAAA,KAAA,YAAA,mFAAA,IAAA,vYAAKC;AAIL,oBAAA,pBAAMC,gDAAU;AAAhB,AAAA,kDAAA,sEAAA,0DAAA,nEACcC;;AAGd,qBAAA,rBAAMC,kDAAW,KAAK;AAAtB,AACE,0CAAA,mFAAA,tHAACC,8BAAUC,0JAAeC,eAAKC;;AAEjC,AAAKC,gDAAY,AAACP,4BAASH,zDACV,6EAAA,mFAAA,IAAA,pKAACK;AA0BlB,oBAAA,pBAAMM,gDAAU,KAAK;AAArB,AACE,0CAAA,mFAAA,tHAACL,8BAAUC,0JAAeK,eAAKH;;AAEjC,2BAAA,3BAAMI,8DAAiB,KAAK;AAA5B,AACE,+BAAA,WAAA,nCAACC;AAAD,AAAM,gDAAAC,zCAACD,wBAAIE,kCAAKP;GAAO,AAAA,2FAAWF;;AAEpC,iCAAA,jCAAMU,0EAAuB,KAAK;AAAlC,AACE,OAACC,2BAAO,AAAA,wFAASX,MAAM,AAACM,mCAAgBN,KAAKE;;mGAE3C,AAACN,4BAASF,zDACV,6EAAA,mFAAA,IAAA,pKAACI,7BACD,8MAAA,mFAAA,IAAA,rSAACA,zCACD,2VAAA,mFAAA,IAAA,lbAACY","names":["viz.grid\/euclidean","viz.grid\/isometric","viz.grid\/hexagonal","viz.grid\/new-grid","grid-def","viz.grid\/add-point","cljs.core\/update-in","grid","cljs.core\/conj","point","viz.grid\/my-grid","viz.grid\/rm-point","cljs.core\/disj","viz.grid\/adjacent-points","cljs.core\/map","p1__10844#","cljs.core\/+","viz.grid\/empty-adjacent-points","cljs.core\/remove"]}
\ No newline at end of file |