Skip to content

Commit 53fb567

Browse files
committed
images
1 parent f9d02ca commit 53fb567

File tree

6 files changed

+12
-3
lines changed

6 files changed

+12
-3
lines changed

results/ex63/plife.jpg

124 KB
Loading

results/ex64/lenia.jpg

62.8 KB
Loading

results/ex65/rd.jpg

207 KB
Loading

src/ex63_particle_life.clj

+4-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
(Particle. (fix-pos np) (fix-vel np nv) ptype))) particles))
9999

100100
(defn draw
101-
[canvas window _ [setup particles]]
101+
[canvas window frame [setup particles]]
102102
(let [particles (if (c2d/mouse-pressed? window)
103103
(conj particles (Particle. (c2d/mouse-pos window)
104104
(Vec2. 0.0 0.0)
@@ -110,12 +110,13 @@
110110
^ParticleType ptype (.ptype s)]]
111111
(c2d/set-color canvas (.color ptype))
112112
(c2d/ellipse canvas (.x p) (.y p) 4 4))
113+
#_(when (= frame 200) (c2d/save canvas "results/ex63/plife.jpg"))
113114
[setup (move setup particles 0.1)]))
114115

115116
(def window (c2d/show-window {:canvas (c2d/black-canvas csize csize :highest)
116117
:draw-fn draw
117118
:background :black
118-
:draw-state (let [setup (random-setup (r/irand 2 5))]
119+
:draw-state (let [setup (random-setup (r/irand 2 6))]
119120
(pp/pprint setup)
120-
[setup (random-particles setup 1000)])}))
121+
[setup (random-particles setup 1200)])}))
121122

src/ex64_particle_lenia.clj

+2
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@
7373
:background :black
7474
:draw-state (repeatedly 350 #(Vec2. (r/grand 3.5)
7575
(r/grand 3.5)))}))
76+
77+
(comment (c2d/save window "results/ex64/lenia.jpg"))

src/ex65_reaction_diffusion.clj

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
;; https://www.karlsims.com/rd.html
2+
3+
;; press space to select k and f
4+
;; press m to back to a map
5+
;; left click to seed B
6+
27
(ns ex65-reaction-diffusion
38
(:require [fastmath.core :as m]
49
[fastmath.random :as r]
@@ -116,3 +121,4 @@
116121
:background :black
117122
:draw-state (step (setup))}))
118123

124+
(comment (c2d/save window "results/ex65/rd.jpg"))

0 commit comments

Comments
 (0)