question: public static IBoard generateRandom ( MapSettings mapSettings ) { int elevationMap [ ] [ ] = new int [ mapSettings . getBoardWidth ( ) ] [ mapSettings . getBoardHeight ( ) ] ; double sizeScale = ( double ) ( mapSettings . getBoardWidth ( ) * mapSettings . getBoardHeight ( ) ) / ( ( double ) ( 16 * 17 ) ) ; generateElevation ( mapSettings . getHilliness ( ) , mapSettings . getBoardWidth ( ) , mapSettings . getBoardHeight ( ) , mapSettings . getRange ( ) + 1 , mapSettings . getProbInvert ( ) , mapSettings . getInvertNegativeTerrain ( ) , elevationMap , mapSettings . getAlgorithmToUse ( ) ) ; IHex [ ] nb = new IHex [ mapSettings . getBoardWidth ( ) * mapSettings . getBoardHeight ( ) ] ; int index = 0 ; for ( int h = 0 ; h < mapSettings . getBoardHeight ( ) ; h ++ ) { for ( int w = 0 ; w < mapSettings . getBoardWidth ( ) ; w ++ ) { if ( mapSettings . getMedium ( ) == MapSettings . MEDIUM_SPACE ) { nb [ index ++ ] = new Hex ( 0 , "space:1" , mapSettings . getTheme ( ) , new Coords ( w , h ) ) ; } else { nb [ index ++ ] = new Hex ( elevationMap [ w ] [ h ] , "" , mapSettings . getTheme ( ) , new Coords ( w , h ) ) ; } } } IBoard result = new Board ( mapSettings . getBoardWidth ( ) , mapSettings . getBoardHeight ( ) , nb ) ; if ( mapSettings . getMedium ( ) == MapSettings . MEDIUM_SPACE ) { result . setType ( Board . T_SPACE ) ; return result ; } HashMap < IHex , Point > reverseHex = new HashMap < IHex , Point > ( 2 * mapSettings . getBoardWidth ( ) * mapSettings . getBoardHeight ( ) ) ; for ( int y = 0 ; y < mapSettings . getBoardHeight ( ) ; y ++ ) { for ( int x = 0 ; x < mapSettings . getBoardWidth ( ) ; x ++ ) { reverseHex . put ( result . getHex ( x , y ) , new Point ( x , y ) ) ; } } int peaks = mapSettings . getMountainPeaks ( ) ; while ( peaks > 0 ) { peaks -- ; int mountainHeight = mapSettings . getMountainHeightMin ( ) + Compute . randomInt ( 1 + mapSettings . getMountainHeightMax ( ) - mapSettings . getMountainHeightMin ( ) ) ; int mountainWidth = mapSettings . getMountainWidthMin ( ) + Compute . randomInt ( 1 + mapSettings . getMountainWidthMax ( ) - mapSettings . getMountainWidthMin ( ) ) ; int mapWidth = result . getWidth ( ) ; int mapHeight = result . getHeight ( ) ; Coords peak = new Coords ( mapWidth / 4 + Compute . randomInt ( ( mapWidth + 1 ) / 2 ) , mapHeight / 4 + Compute . randomInt ( ( mapHeight + 1 ) / 2 ) ) ; generateMountain ( result , mountainWidth , peak , mountainHeight , mapSettings . getMountainStyle ( ) ) ; } if ( mapSettings . getCliffs ( ) > 0 ) { addCliffs ( result , mapSettings . getCliffs ( ) ) ; } int count = mapSettings . getMinForestSpots ( ) ; if ( mapSettings . getMaxForestSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxForestSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . WOODS , mapSettings . getProbHeavy ( ) , mapSettings . getMinForestSize ( ) , mapSettings . getMaxForestSize ( ) , reverseHex , true ) ; } count = mapSettings . getMinRoughSpots ( ) ; if ( mapSettings . getMaxRoughSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxRoughSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . ROUGH , 0 , mapSettings . getMinRoughSize ( ) , mapSettings . getMaxRoughSize ( ) , reverseHex , true ) ; } count = mapSettings . getMinSandSpots ( ) ; if ( mapSettings . getMaxSandSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxSandSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . SAND , 0 , mapSettings . getMinSandSize ( ) , mapSettings . getMaxSandSize ( ) , reverseHex , true ) ; } count = mapSettings . getMinPlantedFieldSpots ( ) ; if ( mapSettings . getMaxPlantedFieldSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxPlantedFieldSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . FIELDS , 0 , mapSettings . getMinPlantedFieldSize ( ) , mapSettings . getMaxPlantedFieldSize ( ) , reverseHex , true ) ; } count = mapSettings . getMinSwampSpots ( ) ; if ( mapSettings . getMaxSwampSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxSwampSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . SWAMP , 0 , mapSettings . getMinSwampSize ( ) , mapSettings . getMaxSwampSize ( ) , reverseHex , false ) ; } count = mapSettings . getMinFortifiedSpots ( ) ; if ( mapSettings . getMaxFortifiedSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxFortifiedSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . FORTIFIED , 0 , mapSettings . getMinFortifiedSize ( ) , mapSettings . getMaxFortifiedSize ( ) , reverseHex , false ) ; } count = mapSettings . getMinRubbleSpots ( ) ; if ( mapSettings . getMaxRubbleSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxRubbleSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . RUBBLE , 0 , mapSettings . getMinRubbleSize ( ) , mapSettings . getMaxRubbleSize ( ) , reverseHex , true ) ; } count = mapSettings . getMinWaterSpots ( ) ; if ( mapSettings . getMaxWaterSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxWaterSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . WATER , mapSettings . getProbDeep ( ) , mapSettings . getMinWaterSize ( ) , mapSettings . getMaxWaterSize ( ) , reverseHex , true ) ; } count = mapSettings . getMinPavementSpots ( ) ; if ( mapSettings . getMaxPavementSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxPavementSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . PAVEMENT , 0 , mapSettings . getMinPavementSize ( ) , mapSettings . getMaxPavementSize ( ) , reverseHex , true ) ; } count = mapSettings . getMinIceSpots ( ) ; if ( mapSettings . getMaxIceSpots ( ) > 0 ) { count += Compute . randomInt ( mapSettings . getMaxIceSpots ( ) ) ; } count *= sizeScale ; for ( int i = 0 ; i < count ; i ++ ) { placeSomeTerrain ( result , Terrains . ICE , 0 , mapSettings . getMinIceSize ( ) , mapSettings . getMaxIceSize ( ) , reverseHex , true ) ; } if ( Compute . randomInt ( 100 ) < mapSettings . getProbCrater ( ) ) { addCraters ( result , mapSettings . getMinRadius ( ) , mapSettings . getMaxRadius ( ) , ( int ) ( mapSettings . getMinCraters ( ) * sizeScale ) , ( int ) ( mapSettings . getMaxCraters ( ) * sizeScale ) ) ; } if ( Compute . randomInt ( 100 ) < mapSettings . getProbRiver ( ) ) { addRiver ( result , reverseHex ) ; } if ( Compute . randomInt ( 100 ) < mapSettings . getProbFlood ( ) ) { postProcessFlood ( nb , mapSettings . getFxMod ( ) ) ; } if ( Compute . randomInt ( 100 ) < mapSettings . getProbDrought ( ) ) { postProcessDrought ( nb , mapSettings . getFxMod ( ) ) ; } if ( Compute . randomInt ( 100 ) < mapSettings . getProbFreeze ( ) ) { postProcessDeepFreeze ( nb , mapSettings . getFxMod ( ) ) ; } if ( Compute . randomInt ( 100 ) < mapSettings . getProbForestFire ( ) ) { postProcessForestFire ( nb , mapSettings . getFxMod ( ) ) ; } boolean roadNeeded = false ; if ( Compute . randomInt ( 100 ) < mapSettings . getProbRoad ( ) ) { roadNeeded = true ; } ArrayList < BuildingTemplate > buildings = mapSettings . getBoardBuildings ( ) ; CityBuilder cityBuilder = new CityBuilder ( mapSettings , result ) ; if ( buildings . size ( ) == 0 ) { buildings = cityBuilder . generateCity ( roadNeeded ) ; } for ( int i = 0 ; i < buildings . size ( ) ; i ++ ) { placeBuilding ( result , ( buildings . get ( i ) ) ) ; } return result ; }
target:  Generates a Random Board