Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

Commit cf21cd5

Browse files
committed
Merge branch 'master' of github.com:nature-of-code/noc-examples-p5.js
2 parents dcf6fc7 + 9b67d5e commit cf21cd5

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 The Nature of Code
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

chp00_introduction/NOC_I_03_RandomWalkTendsToRight/sketch.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Walker{
2727
};
2828

2929
step(){
30-
let choice = floor(random(4));
3130
let r = random(1);
3231
// A 40% of moving to the right!
3332
if (r < 0.4) {

chp01_vectors/NOC_1_09_motion101_acceleration/mover.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ class Mover{
1313
}
1414

1515
update() {
16-
17-
// this.acceleration = p5.Vector.random2D();
18-
// random2D() not implemented? doing raw math for now instead
19-
var angle = random(TWO_PI);
20-
this.acceleration = createVector(cos(angle),sin(angle));
16+
this.acceleration = p5.Vector.random2D();
2117
this.acceleration.mult(random(2));
2218

2319
this.velocity.add(this.acceleration);

chp04_systems/NOC_4_08_ParticleSystemSmoke/particlesystem.js renamed to chp04_systems/NOC_4_08_ParticleSystemSmoke/particle_system.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ class ParticleSystem {
3737
this.particles.push(new Particle(this.origin, this.img));
3838
}
3939

40-
}
40+
}

chp09_ga/NOC_9_01_GA_Shakespeare/DNA.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// -- mutate DNA
1414

1515
function newChar() {
16-
let c = floor(random(63, 122));
16+
let c = floor(random(63, 123));
1717
if (c === 63) c = 32;
1818
if (c === 64) c = 46;
1919

@@ -70,4 +70,4 @@ class DNA {
7070
}
7171
}
7272
}
73-
}
73+
}

chp09_ga/NOC_9_01_GA_Shakespeare_simplified/DNA.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// -- mutate DNA
1414

1515
function newChar() {
16-
let c = floor(random(64, 122));
16+
let c = floor(random(64, 123));
1717
if (c === 64) c = 32;
1818

1919
return String.fromCharCode(c);
@@ -69,4 +69,4 @@ class DNA {
6969
}
7070
}
7171
}
72-
}
72+
}

0 commit comments

Comments
 (0)