diff --git a/content/11_nn_ga.html b/content/11_nn_ga.html index 9da203af..451f6659 100644 --- a/content/11_nn_ga.html +++ b/content/11_nn_ga.html @@ -165,7 +165,7 @@

Coding Flappy Bird

Example 11.1: Flappy Bird Clone

-
+
@@ -439,7 +439,7 @@

Heredity: Baby Birds

Example 11.2: Flappy Bird with Neuroevolution

-
+
@@ -506,7 +506,7 @@

Steering the Neuroevolutionary Way

Example 11.3: Smart Rockets with Neuroevolution

-
+
@@ -641,7 +641,7 @@

Speeding Up Time

Example 11.4: Dynamic Neuroevolutionary Steering

-
+
@@ -749,7 +749,7 @@

Sensing the Environment

Example 11.5: A Bloop with Sensors

-
+
@@ -879,7 +879,7 @@

Learning from the Sensors

Example 11.6: A Neuroevolutionary Ecosystem

-
+
diff --git a/content/examples/04_particles/4_6_particle_system_forces/sketch.js b/content/examples/04_particles/4_6_particle_system_forces/sketch.js index d935ec2d..1aef5ac9 100644 --- a/content/examples/04_particles/4_6_particle_system_forces/sketch.js +++ b/content/examples/04_particles/4_6_particle_system_forces/sketch.js @@ -19,7 +19,3 @@ function draw() { emitter.addParticle(); emitter.run(); } - -function mousePressed(){ - save('screenshot.png') -} \ No newline at end of file diff --git a/content/examples/10_nn/10_2_gesture_classifier/index.html b/content/examples/10_nn/10_2_gesture_classifier/index.html index 83d9fa36..65537711 100644 --- a/content/examples/10_nn/10_2_gesture_classifier/index.html +++ b/content/examples/10_nn/10_2_gesture_classifier/index.html @@ -1,8 +1,8 @@ - - + + diff --git a/content/examples/10_nn/10_2_gesture_classifier/sketch.js b/content/examples/10_nn/10_2_gesture_classifier/sketch.js index 801fd042..a0cef108 100644 --- a/content/examples/10_nn/10_2_gesture_classifier/sketch.js +++ b/content/examples/10_nn/10_2_gesture_classifier/sketch.js @@ -16,6 +16,7 @@ let start, end; function setup() { createCanvas(640, 240); + ml5.setBackend('cpu'); // Step 2: set your neural network options let options = { task: "classification", diff --git a/content/examples/11_nn_ga/11_3_flappy_bird/bird.js b/content/examples/11_nn_ga/11_1_flappy_bird/bird.js similarity index 100% rename from content/examples/11_nn_ga/11_3_flappy_bird/bird.js rename to content/examples/11_nn_ga/11_1_flappy_bird/bird.js diff --git a/content/examples/11_nn_ga/11_3_flappy_bird/index.html b/content/examples/11_nn_ga/11_1_flappy_bird/index.html similarity index 100% rename from content/examples/11_nn_ga/11_3_flappy_bird/index.html rename to content/examples/11_nn_ga/11_1_flappy_bird/index.html diff --git a/content/examples/11_nn_ga/11_3_flappy_bird/pipe.js b/content/examples/11_nn_ga/11_1_flappy_bird/pipe.js similarity index 100% rename from content/examples/11_nn_ga/11_3_flappy_bird/pipe.js rename to content/examples/11_nn_ga/11_1_flappy_bird/pipe.js diff --git a/content/examples/11_nn_ga/11_3_flappy_bird/screenshot.png b/content/examples/11_nn_ga/11_1_flappy_bird/screenshot.png similarity index 100% rename from content/examples/11_nn_ga/11_3_flappy_bird/screenshot.png rename to content/examples/11_nn_ga/11_1_flappy_bird/screenshot.png diff --git a/content/examples/11_nn_ga/11_3_flappy_bird/sketch.js b/content/examples/11_nn_ga/11_1_flappy_bird/sketch.js similarity index 100% rename from content/examples/11_nn_ga/11_3_flappy_bird/sketch.js rename to content/examples/11_nn_ga/11_1_flappy_bird/sketch.js diff --git a/content/examples/11_nn_ga/11_3_flappy_bird/style.css b/content/examples/11_nn_ga/11_1_flappy_bird/style.css similarity index 100% rename from content/examples/11_nn_ga/11_3_flappy_bird/style.css rename to content/examples/11_nn_ga/11_1_flappy_bird/style.css diff --git a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/bird.js b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/bird.js similarity index 96% rename from content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/bird.js rename to content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/bird.js index 7eddf362..54c0c54a 100644 --- a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/bird.js +++ b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/bird.js @@ -10,8 +10,7 @@ class Bird { task: "classification", // change to "neuroEvolution" for next ml5.js release - noTraining: true - // neuroEvolution: true, + neuroEvolution: true, }); } diff --git a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/index.html b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/index.html similarity index 78% rename from content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/index.html rename to content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/index.html index 6ba97b0c..3c18c5c1 100644 --- a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/index.html +++ b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/index.html @@ -1,8 +1,8 @@ - - + + diff --git a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/pipe.js b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/pipe.js similarity index 100% rename from content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/pipe.js rename to content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/pipe.js diff --git a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/screenshot.png b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/screenshot.png similarity index 100% rename from content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/screenshot.png rename to content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/screenshot.png diff --git a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/sketch.js b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/sketch.js similarity index 99% rename from content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/sketch.js rename to content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/sketch.js index 057c3c1a..69eeab54 100644 --- a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/sketch.js +++ b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/sketch.js @@ -3,12 +3,11 @@ let pipes = []; function setup() { createCanvas(640, 240); + ml5.tf.setBackend("cpu"); for (let i = 0; i < 200; i++) { birds[i] = new Bird(); } pipes.push(new Pipe()); - - ml5.tf.setBackend("cpu"); } function draw() { diff --git a/content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/style.css b/content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/style.css similarity index 100% rename from content/examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/style.css rename to content/examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/style.css diff --git a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/index.html b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/index.html similarity index 86% rename from content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/index.html rename to content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/index.html index e406e4cc..7218b929 100644 --- a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/index.html +++ b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/index.html @@ -2,7 +2,7 @@ - + Nature of Code Example 9.3: Smart Rockets diff --git a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/obstacle.js b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/obstacle.js similarity index 100% rename from content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/obstacle.js rename to content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/obstacle.js diff --git a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/population.js b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/population.js similarity index 100% rename from content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/population.js rename to content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/population.js diff --git a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/rocket.js b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/rocket.js similarity index 99% rename from content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/rocket.js rename to content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/rocket.js index ae9d4983..eb63c5c0 100644 --- a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/rocket.js +++ b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/rocket.js @@ -30,7 +30,7 @@ class Rocket { inputs: 2, outputs: 2, task: "regression", - noTraining: true, + neuroEvolution: true, }); } } diff --git a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/screenshot.png b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/screenshot.png similarity index 100% rename from content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/screenshot.png rename to content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/screenshot.png diff --git a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/sketch.js b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/sketch.js similarity index 100% rename from content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/sketch.js rename to content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/sketch.js diff --git a/content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/style.css b/content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/style.css similarity index 100% rename from content/examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/style.css rename to content/examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/style.css diff --git a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/creature.js b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/creature.js similarity index 97% rename from content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/creature.js rename to content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/creature.js index 529f1daf..389f765d 100644 --- a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/creature.js +++ b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/creature.js @@ -14,8 +14,7 @@ class Creature { inputs: 5, outputs: 2, task: "regression", - // neuroEvolution: true, - noTraining: true, + neuroEvolution: true, }); } } diff --git a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/glow.js b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/glow.js similarity index 100% rename from content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/glow.js rename to content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/glow.js diff --git a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/index.html b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/index.html similarity index 85% rename from content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/index.html rename to content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/index.html index e7fad58b..108bc9c7 100644 --- a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/index.html +++ b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/index.html @@ -2,7 +2,7 @@ - + Nature of Code Example 9.3: Smart Rockets diff --git a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/population.js b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/population.js similarity index 100% rename from content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/population.js rename to content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/population.js diff --git a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/screenshot.png b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/screenshot.png similarity index 100% rename from content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/screenshot.png rename to content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/screenshot.png diff --git a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/sketch.js b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/sketch.js similarity index 100% rename from content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/sketch.js rename to content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/sketch.js diff --git a/content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/style.css b/content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/style.css similarity index 100% rename from content/examples/11_nn_ga/10_6_neuro_evolution_steering_seek/style.css rename to content/examples/11_nn_ga/11_4_neuro_evolution_steering_seek/style.css diff --git a/content/examples/11_nn_ga/10_7_creature_sensors/creature.js b/content/examples/11_nn_ga/11_5_creature_sensors/creature.js similarity index 100% rename from content/examples/11_nn_ga/10_7_creature_sensors/creature.js rename to content/examples/11_nn_ga/11_5_creature_sensors/creature.js diff --git a/content/examples/11_nn_ga/10_7_creature_sensors/food.js b/content/examples/11_nn_ga/11_5_creature_sensors/food.js similarity index 100% rename from content/examples/11_nn_ga/10_7_creature_sensors/food.js rename to content/examples/11_nn_ga/11_5_creature_sensors/food.js diff --git a/content/examples/11_nn_ga/10_7_creature_sensors/index.html b/content/examples/11_nn_ga/11_5_creature_sensors/index.html similarity index 100% rename from content/examples/11_nn_ga/10_7_creature_sensors/index.html rename to content/examples/11_nn_ga/11_5_creature_sensors/index.html diff --git a/content/examples/11_nn_ga/10_7_creature_sensors/screenshot.png b/content/examples/11_nn_ga/11_5_creature_sensors/screenshot.png similarity index 100% rename from content/examples/11_nn_ga/10_7_creature_sensors/screenshot.png rename to content/examples/11_nn_ga/11_5_creature_sensors/screenshot.png diff --git a/content/examples/11_nn_ga/10_7_creature_sensors/sensor.js b/content/examples/11_nn_ga/11_5_creature_sensors/sensor.js similarity index 100% rename from content/examples/11_nn_ga/10_7_creature_sensors/sensor.js rename to content/examples/11_nn_ga/11_5_creature_sensors/sensor.js diff --git a/content/examples/11_nn_ga/10_7_creature_sensors/sketch.js b/content/examples/11_nn_ga/11_5_creature_sensors/sketch.js similarity index 100% rename from content/examples/11_nn_ga/10_7_creature_sensors/sketch.js rename to content/examples/11_nn_ga/11_5_creature_sensors/sketch.js diff --git a/content/examples/11_nn_ga/10_7_creature_sensors/style.css b/content/examples/11_nn_ga/11_5_creature_sensors/style.css similarity index 100% rename from content/examples/11_nn_ga/10_7_creature_sensors/style.css rename to content/examples/11_nn_ga/11_5_creature_sensors/style.css diff --git a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/creature.js b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/creature.js similarity index 98% rename from content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/creature.js rename to content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/creature.js index ab9f822f..7d19624c 100644 --- a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/creature.js +++ b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/creature.js @@ -24,8 +24,7 @@ class Creature { inputs: this.sensors.length, outputs: 2, task: "regression", - noTraining: true, - // neuroEvolution: true, + neuroEvolution: true, }); } } diff --git a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/food.js b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/food.js similarity index 100% rename from content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/food.js rename to content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/food.js diff --git a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/index.html b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/index.html similarity index 86% rename from content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/index.html rename to content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/index.html index 9cb8ae40..0f8fb6ed 100644 --- a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/index.html +++ b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/index.html @@ -2,7 +2,7 @@ - + Nature of Code Example 9.3: Smart Rockets diff --git a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/screenshot.png b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/screenshot.png similarity index 100% rename from content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/screenshot.png rename to content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/screenshot.png diff --git a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/sensor.js b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/sensor.js similarity index 100% rename from content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/sensor.js rename to content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/sensor.js diff --git a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/sketch.js b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/sketch.js similarity index 100% rename from content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/sketch.js rename to content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/sketch.js diff --git a/content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/style.css b/content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/style.css similarity index 100% rename from content/examples/11_nn_ga/10_8_neuroevolution_ecosystem/style.css rename to content/examples/11_nn_ga/11_6_neuroevolution_ecosystem/style.css