public void processToNextGeneration() {

    // notation
    if (generationNumber == -1) Collections.sort(currentPopulation);

    List<ChessBoard> bestEntities = currentPopulation.subList(0, currentPopulation.size() / 2);

    // couplage
    List<ChessBoard> newPopulation = new ArrayList<ChessBoard>();

    double mutation = 0.1;

    for (int i = 0, size = bestEntities.size() / 2; i < size; i++) {

      ChessBoard entityA = bestEntities.remove(0);
      newPopulation.add(entityA);

      if (bestEntities.isEmpty()) break;

      int indexPartner = (int) (Math.random() * bestEntities.size());
      ChessBoard entityB = bestEntities.remove(indexPartner);
      newPopulation.add(entityB);

      ChessBoard[] children =
          entityA.reproduce(entityB, (int) (Math.random() * entityB.getDNALength()));

      if (Math.random() < mutation) children[0].mutate();

      if (Math.random() < mutation) children[1].mutate();

      newPopulation.add(children[0]);
      newPopulation.add(children[1]);
    }

    currentPopulation = newPopulation;

    Collections.sort(currentPopulation);
    generationNumber++;
  }