//Crossover clásico de dos puntos
function Crossover ( rate ) {
  if ( ! rate ) {
    return;
  }
  this.rate = rate;
  this.arity = 2;
  this.apply = xover_apply;
}

// Se aplica al primer guy
function xover_apply( guy_1, guy_2 ) {
  var other_guy = guy_1.clone();
  var this_len = other_guy.chromosome.length;
  var point_1 = Math.floor( Math.random()* this_len);
  var len = 1+Math.floor( Math.random()*(this_len - point_1 - 1));
  other_guy.chromosome = guy_1.chromosome.substr(0,point_1) +
    guy_2.chromosome.substr(point_1, len) +
    guy_1.chromosome.substr(point_1+len, this_len - (point_1 + len ));
  other_guy.fitness = null;
  return other_guy
}

