Ejemplo n.º 1
0
  protected Point getRegionDimension(BoardState origState, int cellregion) {
    Vector<CellLocation> cells;
    CellLocation tempcell;
    int rheight = 0;
    int rwidth = 0;
    int xmin, xmax, ymin, ymax;
    xmin = ymin = 1000000;
    xmax = ymax = -1000000;
    Region region = ((Region[]) origState.getExtraData().get(0))[cellregion];
    cells = region.getCells();

    for (int c = 0; c < cells.size(); ++c) {
      if (origState.getCellContents(cells.get(c).getX(), cells.get(c).getY())
          == Heyawake.CELL_WHITE) {
        continue;
      }
      if (cells.get(c).getX() < xmin) xmin = cells.get(c).getX();
      if (cells.get(c).getY() < ymin) ymin = cells.get(c).getY();

      if (cells.get(c).getX() > xmax) xmax = cells.get(c).getX();
      if (cells.get(c).getY() > ymax) ymax = cells.get(c).getY();
    }
    rwidth = xmax - xmin;
    rheight = ymax - ymin;
    return new Point(rwidth, rheight);
  }
Ejemplo n.º 2
0
 public static void setCellPossibleValues() {
   for (int i = 0; i < Board.getRegions().size(); i++) {
     for (Region region : Board.getRegions()) {
       for (Cell cell : region.getCells()) {
         cell.setPossibleValues(region.getPossibleValues());
       }
     }
   }
 }
Ejemplo n.º 3
0
 protected Point getRegionLocation(BoardState origState, int cellregion) {
   Vector<CellLocation> cells;
   CellLocation tempcell;
   int xmin, ymin;
   xmin = ymin = 1000000;
   Region region = ((Region[]) origState.getExtraData().get(0))[cellregion];
   cells = region.getCells();
   for (int c = 0; c < cells.size(); ++c) {
     if (origState.getCellContents(cells.get(c).getX(), cells.get(c).getY())
         == Heyawake.CELL_WHITE) {
       continue;
     }
     if (cells.get(c).getX() < xmin) xmin = cells.get(c).getX();
     if (cells.get(c).getY() < ymin) ymin = cells.get(c).getY();
   }
   return new Point(xmin, ymin);
 }