Skip to content

Instantly share code, notes, and snippets.

@Shikugawa
Shikugawa / GeneticAlgorithm.pde
Created April 3, 2017 12:07
GeneticAlgorithm.pde
class DNA{
float[] x = new float[1000];
float[] y = new float[1000];
DNA(){
for(int i = 0; i < x.length - 1; i++){
x[i+1] += x[i] > 0 ? random(-1, 1) : random(0, 1);
y[i+1] += y[i] > 0 ? random(-1, 1) : random(0, 1);
}
}