ga.js
// Normalize the fitness of all birds

Normalize the fitness of all birds
Normalize the fitness of all birds
function normalizeFitness(boards) {
  for (let i = 0; i < boards.length; i++) {
    boards[i].score = pow(boards[i].score, 2);
  }
  let sum = 0;
  for (let i = 0; i < boards.length; i++) {
    sum += boards[i].score;
  }
  for (let i = 0; i < boards.length; i++) {
    boards[i].fitness = boards[i].score / sum;
  }
}
function normalizeFitness ( boards ) { for ( let i = 0 ; i < boards . length ; i ++ ) { boards [ i ] . score = pow ( boards [ i ] . score , 2 ) ; } let sum = 0 ; for ( let i = 0 ; i < boards . length ; i ++ ) { sum += boards [ i ] . score ; } for ( let i = 0 ; i < boards . length ; i ++ ) { boards [ i ] . fitness = boards [ i ] . score / sum ; } }
Normalize the fitness of all birds
Normalize the fitness of all birds
// Make score exponentially better?
 // Add up all the scores
 // Divide by the sum
