Files
processing4/java/examples/Books/Nature of Code/chp10_nn/LayeredNetworkViz/Neuron.pde
2012-12-11 20:04:34 +00:00

32 lines
555 B
Plaintext

// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
class Neuron {
PVector location;
ArrayList<Connection> connections;
Neuron(float x, float y) {
location = new PVector(x, y);
connections = new ArrayList<Connection>();
}
void connect(Neuron n) {
Connection c = new Connection(this, n, random(1));
connections.add(c);
}
void display() {
stroke(0);
strokeWeight(1);
fill(0);
ellipse(location.x, location.y, 16, 16);
for (Connection c : connections) {
c.display();
}
}
}