News for hackers. Stuff that matters.
Re:Genetic Algorithms in CoffeeScript by tinco on Sunday September 23, 2012 @09:59AM (#4560945)
In all code examples you can press the down arrow to view the horrible (c-style) Javascript source.

The javascript seems to be mainly horrible because of the coffeescript code being object oriented and its lack of a more powerful looping construct.

Re:Genetic Algorithms in CoffeeScript by ville on Sunday September 23, 2012 @05:07PM (#4562049)
It looks like there is something missing in the first example in Javascript.

Population = (function() { Population.prototype.genomes = []; })();

This throws a ReferenceError because Population is not defined.

Genome = (function() {

  Genome.prototype.values = [];

  function Genome(values) {
    this.values = values != null ? values : this.initial();
  }

  Genome.prototype.inital = function(){
    return [RANDOMARRAY FROM [0-14]]
  }
})();

After this part Genome will be undefined.

Re:Genetic Algorithms in CoffeeScript by janmonschke on Sunday September 23, 2012 @06:45PM (#4562360)
Thx, forgot to copy the var statements. It's fixed now.