Skip to content

Commit

Permalink
make bubbles deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Feb 11, 2024
1 parent 9a0026c commit 984c69d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/shimmers/sketches/bubbles.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
[shimmers.common.framerate :as framerate]
[shimmers.common.quil :as cq]
[shimmers.common.ui.controls :as ctrl]
[shimmers.math.probability :as p]
[shimmers.math.deterministic-random :as dr]
[shimmers.sketch :as sketch :include-macros true]
[thi.ng.geom.circle :as gc]
[thi.ng.geom.core :as g]
[thi.ng.geom.vector :as gv]
[thi.ng.math.core :as tm]))

(defn make-bubble []
(gc/circle (cq/rel-pos (rand) 1.0)
(+ 1 (rand-int 6))))
(gc/circle (cq/rel-pos (dr/random) 1.0)
(+ 1 (dr/random-int 6))))

(defn setup []
{:bubbles []})
Expand Down Expand Up @@ -49,7 +49,7 @@
(defn update-state [{:keys [bubbles] :as state}]
(let [active (keep update-bubble (combine-intersecting bubbles))]
(assoc state :bubbles
(if (and (p/chance 0.03)
(if (and (dr/chance 0.03)
(< (count active) 512))
(conj active (make-bubble))
active))))
Expand Down

0 comments on commit 984c69d

Please sign in to comment.