protected static void placeSomeTerrain(IBoard board,int terrainType,int probMore,int minHexes,int maxHexes,HashMap<IHex,Point> reverseHex,boolean exclusive){
  Point p=new Point(Compute.randomInt(board.getWidth()),Compute.randomInt(board.getHeight()));
  int count=minHexes;
  if ((maxHexes - minHexes) > 0) {
    count+=Compute.randomInt(maxHexes - minHexes);
  }
  IHex field;
  HashSet<IHex> alreadyUsed=new HashSet<IHex>();
  HashSet<IHex> unUsed=new HashSet<IHex>();
  field=board.getHex(p.x,p.y);
  if (!field.containsTerrain(terrainType)) {
    unUsed.add(field);
  }
 else {
    findAllUnused(board,terrainType,alreadyUsed,unUsed,field,reverseHex);
  }
  ITerrainFactory f=Terrains.getTerrainFactory();
  for (int i=0; i < count; i++) {
    if (unUsed.isEmpty()) {
      return;
    }
    int which=Compute.randomInt(unUsed.size());
    Iterator<IHex> iter=unUsed.iterator();
    for (int n=0; n < (which - 1); n++) {
      iter.next();
    }
    field=iter.next();
    if (exclusive) {
      field.removeAllTerrains();
    }
    int tempInt=(Compute.randomInt(100) < probMore) ? 2 : 1;
    ITerrain tempTerrain=f.createTerrain(terrainType,tempInt);
    field.addTerrain(tempTerrain);
    unUsed.remove(field);
    findAllUnused(board,terrainType,alreadyUsed,unUsed,field,reverseHex);
  }
  if (terrainType == Terrains.WATER) {
    int min=Integer.MAX_VALUE;
    Iterator<IHex> iter=unUsed.iterator();
    while (iter.hasNext()) {
      field=iter.next();
      if (field.getLevel() < min) {
        min=field.getLevel();
      }
    }
    iter=alreadyUsed.iterator();
    while (iter.hasNext()) {
      field=iter.next();
      field.setLevel(min);
    }
  }
}

protected static void placeSomeTerrain ( IBoard board , int terrainType , int probMore , int minHexes , int maxHexes , HashMap < IHex , Point > reverseHex , boolean exclusive ) { Point p = new Point ( Compute . randomInt ( board . getWidth ( ) ) , Compute . randomInt ( board . getHeight ( ) ) ) ; int count = minHexes ; if ( ( maxHexes - minHexes ) > 0 ) { count += Compute . randomInt ( maxHexes - minHexes ) ; } IHex field ; HashSet < IHex > alreadyUsed = new HashSet < IHex > ( ) ; HashSet < IHex > unUsed = new HashSet < IHex > ( ) ; field = board . getHex ( p . x , p . y ) ; if ( ! field . containsTerrain ( terrainType ) ) { unUsed . add ( field ) ; } else { findAllUnused ( board , terrainType , alreadyUsed , unUsed , field , reverseHex ) ; } ITerrainFactory f = Terrains . getTerrainFactory ( ) ; for ( int i = 0 ; i < count ; i ++ ) { if ( unUsed . isEmpty ( ) ) { return ; } int which = Compute . randomInt ( unUsed . size ( ) ) ; Iterator < IHex > iter = unUsed . iterator ( ) ; for ( int n = 0 ; n < ( which - 1 ) ; n ++ ) { iter . next ( ) ; } field = iter . next ( ) ; if ( exclusive ) { field . removeAllTerrains ( ) ; } int tempInt = ( Compute . randomInt ( 100 ) < probMore ) ? 2 : 1 ; ITerrain tempTerrain = f . createTerrain ( terrainType , tempInt ) ; field . addTerrain ( tempTerrain ) ; unUsed . remove ( field ) ; findAllUnused ( board , terrainType , alreadyUsed , unUsed , field , reverseHex ) ; } if ( terrainType == Terrains . WATER ) { int min = Integer . MAX_VALUE ; Iterator < IHex > iter = unUsed . iterator ( ) ; while ( iter . hasNext ( ) ) { field = iter . next ( ) ; if ( field . getLevel ( ) < min ) { min = field . getLevel ( ) ; } } iter = alreadyUsed . iterator ( ) ; while ( iter . hasNext ( ) ) { field = iter . next ( ) ; field . setLevel ( min ) ; } } }
places randomly some connected woods .
