Skip to content

Commit

Permalink
Add stdev label to Exercise 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramblurr committed May 29, 2024
1 parent be7bed1 commit 32b789d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/noc/chapter_0_4e.cljs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
(ns noc.chapter-0-4e
(:require
[goog.string :as gstring]
[goog.string.format]
[quil.core :as q]))

(def size [640 240])

(defn init-state [_]
{:ui {:stdev {:type :slider
:min 5 :max 120
:value 10}}})
:value 50}}})

(defn setup! [_]
(q/color-mode :hsl 360)
Expand All @@ -24,4 +26,9 @@
y (rand-gaus (quot height 2) stdev)]
(q/no-stroke)
(q/fill (rand-gaus 0 stdev) 200 200 200)
(q/ellipse x y 16 16)))
(q/ellipse x y 16 16)
(q/no-stroke)
(q/fill 360)
(q/rect 0 0 100 35)
(q/fill 0)
(q/text (gstring/format "stdev: %.2f" stdev) 10 20)))

0 comments on commit 32b789d

Please sign in to comment.