Skip to content

Commit

Permalink
Merge pull request #990 from nature-of-code/notion-update-docs
Browse files Browse the repository at this point in the history
Fixing numbering and ml5.js version for chapter 10 and 11 examples
  • Loading branch information
shiffman authored Jul 10, 2024
2 parents ce4235a + 82d093f commit 0221a78
Show file tree
Hide file tree
Showing 44 changed files with 19 additions and 26 deletions.
12 changes: 6 additions & 6 deletions content/11_nn_ga.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ <h2 id="coding-flappy-bird">Coding Flappy Bird</h2>
<div data-type="example">
<h3 id="example-111-flappy-bird-clone">Example 11.1: Flappy Bird Clone</h3>
<figure>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/Pv-JlO0cl" data-example-path="examples/11_nn_ga/11_3_flappy_bird"><img src="examples/11_nn_ga/11_3_flappy_bird/screenshot.png"></div>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/Pv-JlO0cl" data-example-path="examples/11_nn_ga/11_1_flappy_bird"><img src="examples/11_nn_ga/11_1_flappy_bird/screenshot.png"></div>
<figcaption></figcaption>
</figure>
</div>
Expand Down Expand Up @@ -439,7 +439,7 @@ <h3 id="heredity-baby-birds">Heredity: Baby Birds</h3>
<div data-type="example">
<h3 id="example-112-flappy-bird-with-neuroevolution">Example 11.2: Flappy Bird with Neuroevolution</h3>
<figure>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/PEUKc5dpZ" data-example-path="examples/11_nn_ga/11_4_flappy_bird_neuro_evolution"><img src="examples/11_nn_ga/11_4_flappy_bird_neuro_evolution/screenshot.png"></div>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/PEUKc5dpZ" data-example-path="examples/11_nn_ga/11_2_flappy_bird_neuro_evolution"><img src="examples/11_nn_ga/11_2_flappy_bird_neuro_evolution/screenshot.png"></div>
<figcaption></figcaption>
</figure>
</div>
Expand Down Expand Up @@ -506,7 +506,7 @@ <h2 id="steering-the-neuroevolutionary-way">Steering the Neuroevolutionary Way</
<div data-type="example">
<h3 id="example-113-smart-rockets-with-neuroevolution">Example 11.3: Smart Rockets with Neuroevolution</h3>
<figure>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/KkV4lTS4H" data-example-path="examples/11_nn_ga/10_5_smart_rockets_neuro_evolution"><img src="examples/11_nn_ga/10_5_smart_rockets_neuro_evolution/screenshot.png"></div>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/KkV4lTS4H" data-example-path="examples/11_nn_ga/11_3_smart_rockets_neuro_evolution"><img src="examples/11_nn_ga/11_3_smart_rockets_neuro_evolution/screenshot.png"></div>
<figcaption></figcaption>
</figure>
</div>
Expand Down Expand Up @@ -641,7 +641,7 @@ <h3 id="speeding-up-time">Speeding Up Time</h3>
<div data-type="example">
<h3 id="example-114-dynamic-neuroevolutionary-steering">Example 11.4: Dynamic Neuroevolutionary Steering</h3>
<figure>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/fZDfxxVrf" data-example-path="examples/11_nn_ga/10_6_neuro_evolution_steering_seek"><img src="examples/11_nn_ga/10_6_neuro_evolution_steering_seek/screenshot.png"></div>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/fZDfxxVrf" data-example-path="examples/11_nn_ga/11_4_neuro_evolution_steering_seek"><img src="examples/11_nn_ga/11_4_neuro_evolution_steering_seek/screenshot.png"></div>
<figcaption></figcaption>
</figure>
</div>
Expand Down Expand Up @@ -749,7 +749,7 @@ <h3 id="sensing-the-environment">Sensing the Environment</h3>
<div data-type="example">
<h3 id="example-115-a-bloop-with-sensors">Example 11.5: A Bloop with Sensors</h3>
<figure>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/vCTMtXXSS" data-example-path="examples/11_nn_ga/10_7_creature_sensors"><img src="examples/11_nn_ga/10_7_creature_sensors/screenshot.png"></div>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/vCTMtXXSS" data-example-path="examples/11_nn_ga/11_5_creature_sensors"><img src="examples/11_nn_ga/11_5_creature_sensors/screenshot.png"></div>
<figcaption></figcaption>
</figure>
</div>
Expand Down Expand Up @@ -879,7 +879,7 @@ <h3 id="learning-from-the-sensors">Learning from the Sensors</h3>
<div data-type="example">
<h3 id="example-116-a-neuroevolutionary-ecosystem">Example 11.6: A Neuroevolutionary Ecosystem</h3>
<figure>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/IQbcREjUK" data-example-path="examples/11_nn_ga/10_8_neuroevolution_ecosystem"><img src="examples/11_nn_ga/10_8_neuroevolution_ecosystem/screenshot.png"></div>
<div data-type="embed" data-p5-editor="https://editor.p5js.org/natureofcode/sketches/IQbcREjUK" data-example-path="examples/11_nn_ga/11_6_neuroevolution_ecosystem"><img src="examples/11_nn_ga/11_6_neuroevolution_ecosystem/screenshot.png"></div>
<figcaption></figcaption>
</figure>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@ function draw() {
emitter.addParticle();
emitter.run();
}

function mousePressed(){
save('screenshot.png')
}
4 changes: 2 additions & 2 deletions content/examples/10_nn/10_2_gesture_classifier/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
<script src="https://unpkg.com/ml5@latest/dist/ml5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.4/p5.min.js"></script>
<script src="https://unpkg.com/ml5@1.0.1/dist/ml5.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta charset="utf-8" />
</head>
Expand Down
1 change: 1 addition & 0 deletions content/examples/10_nn/10_2_gesture_classifier/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class Bird {
task: "classification",

// change to "neuroEvolution" for next ml5.js release
noTraining: true
// neuroEvolution: true,
neuroEvolution: true,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
<script src="https://unpkg.com/ml5@latest/dist/ml5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.4/p5.min.js"></script>
<script src="https://unpkg.com/ml5@1.0.1/dist/ml5.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta charset="utf-8" />
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
<script src="https://unpkg.com/ml5@latest/dist/ml5.min.js"></script>
<script src="https://unpkg.com/ml5@1.0.1/dist/ml5.min.js"></script>
<meta charset="utf-8" />
<title>Nature of Code Example 9.3: Smart Rockets</title>
<link rel="stylesheet" type="text/css" href="style.css" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Rocket {
inputs: 2,
outputs: 2,
task: "regression",
noTraining: true,
neuroEvolution: true,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class Creature {
inputs: 5,
outputs: 2,
task: "regression",
// neuroEvolution: true,
noTraining: true,
neuroEvolution: true,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
<script src="https://unpkg.com/ml5@latest/dist/ml5.min.js"></script>
<script src="https://unpkg.com/ml5@1.0.1/dist/ml5.min.js"></script>
<meta charset="utf-8" />
<title>Nature of Code Example 9.3: Smart Rockets</title>
<link rel="stylesheet" type="text/css" href="style.css" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class Creature {
inputs: this.sensors.length,
outputs: 2,
task: "regression",
noTraining: true,
// neuroEvolution: true,
neuroEvolution: true,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
<script src="https://unpkg.com/ml5@latest/dist/ml5.min.js"></script>
<script src="https://unpkg.com/ml5@1/dist/ml5.min.js"></script>
<meta charset="utf-8" />
<title>Nature of Code Example 9.3: Smart Rockets</title>
<link rel="stylesheet" type="text/css" href="style.css" />
Expand Down

0 comments on commit 0221a78

Please sign in to comment.