예제 #1
0
 @Override
 public int compareTo(Grid o) {
   return (int) (o.compute() - this.compute());
 }
예제 #2
0
 public SortedSet<Grid> children() {
   SortedSet<Grid> children = new TreeSet<Grid>();
   Grid gridA, gridB;
   int t = 0;
   gridA = new Grid(this);
   for (int i = 0; i < 4; i++) {
     while (gridA.moveRight()) {
       t++;
       gridB = new Grid(gridA);
       while (gridB.moveDown()) gridB.down++;
       gridB.rotations = i;
       gridB.translations = t;
       children.add(gridB);
     }
     while (gridA.moveLeft()) {
       t--;
       gridB = new Grid(gridA);
       while (gridB.moveDown()) gridB.down++;
       gridB.rotations = i;
       gridB.translations = t;
       children.add(gridB);
     }
     gridA.turnClockwise();
   }
   return children;
 }