diff --git a/content/00_randomness.html b/content/00_randomness.html index 7f11e610..dbcb6eb9 100644 --- a/content/00_randomness.html +++ b/content/00_randomness.html @@ -128,20 +128,20 @@
Finally, during each cycle through draw()
, the walker takes a step and draws a dot:
//{!1} Then draw()
loops forever and ever (until you quit).
-function draw() {
- // Call functions on the walker.
- walker.step();
- walker.show();
-}
-Since the background is drawn once in setup()
, rather than clearing it continually each time through draw()
, the trail of the random walk is visible in the canvas.
//{!1} Then draw()
loops forever and ever (until you quit).
+function draw() {
+ // Call functions on the walker.
+ walker.step();
+ walker.show();
+}
Since the background is drawn once in setup()
, rather than clearing it continually each time through draw()
, the trail of the random walk is visible in the canvas.
I could make a couple of adjustments to the random walker. For one, this Walker
object’s steps are limited to four options: up, down, left, and right. But any given pixel in the canvas could have eight possible neighbors, including diagonals (see Figure 0.1). A ninth possibility, to stay in the same place, could also be an option.