3 ms·
JavaScript Genetic Algorithm Visualization
- moron4hire 13y agoAs a quick fiddle, dramatic results can be had with just changing the line: if((i%4)===1) A "1" means it favors green, obviously "0" would favor red and "2" would favor blue. There is a 4th component for alpha channel, but I personally haven't gotten too far into the fitness function finangling to decide if it is useful. This was motivated by the ludicrously over-complicated genetic algorithm example in https://news.ycombinator.com/item?id=5904182 https://news.ycombinator.com/item?id=5904182 While they do require finesse in their configuration, genetic algorithms do not have to be terribly complex in code.
- moron4hire 13y agoI just updated this with a small set of predefined fitness functions that can be selected via a dropdown list in the "edit" view. I'm particularly fond of the "Growing Culture" function, as by simulating reducing fitness over the age of the gene, it makes the genes much more volatile, yet patterns still emerge!