anchor.diff:      for (int i = 0; i < size; i++) {
         pool[i] = new _Gene();
         pool[i].letters = new List<int>(NFACES);
  +      pool[i].reorder = new List<int>(NFACES);
       }
       return pool;
     }
  
positive.code: import 'dawg.dart';
  import 'boggle.dart';
  
  const POOL_SIZE = 1000;
  const BEST_SELECTION = 1;
  
  class _Gene {
    List<int> letters;
    int score;
  }
  
  class Grinder {
    final int BOARD_W;
    final int BOARD_H;   
    final int NFACES;
  
    List<List<int>> dice;
    Dawg dawg;
  
negative.code:       prevPool = pool;
        pool = tmp;
        
        int curGene = 0;
        for (int i = 0; i < NUM_PROPAGATE; i++) {
          tmp = pool[curGene];
          pool[curGene] = prevPool[curGene];
          prevPool[curGene] = tmp;
          curGene++;
        }
        //  crossover
        for (int i = 0; i < NUM_CROSSOVER; i++) {
          int numParents = random.nextInt(MAX_PARENTS - 1) + 2;
          //  pick the random parents
          
          //  cross-fuse the cells
          initGene(pool[curGene]);
          curGene++;
        }     
        //  mutation
        for (int i = 0; i < NUM_MUTATE; i++) {
          tmp = pool[curGene];
          pool[curGene] = prevPool[curGene];
          prevPool[curGene] = tmp;
          
          var g = pool[curGene];
          int mtype = random.nextInt(2);
          int nflips = random.nextInt(MAX_FLIPS);
          if (mtype == 1) {
            //  flip a random die with a random neighbor
            initGene(pool[curGene]);
          }
          else {
            //  rotate a random die
            for (int j = 0; j < nflips; j++) {
              int k = random.nextInt(NFACES);
              var d = dice[g.reorder[k]];
              g.letters[k] = d[random.nextInt(d.length)];
            }
          }
            
          curGene++;
        }
        //  just randomly init the rest
        for (; curGene < POOL_SIZE; curGene++) {
          initGene(pool[curGene]);
          curGene++;
        }
  
        epoch++;
      }
      return new Boggle(getString(pool[0].orderedLetters), BOARD_W, BOARD_H);
    }
    
    initGene(_Gene g) {
      for (int i = 0; i < NFACES; i++) {
        var d = dice[i];
        g.letters[i] = d[random.nextInt(d.length)];
        g.reorder[i] = i;
      }
      g.reorder.shuffle(random);
    }
  }
  