Hex[] nb = new Hex[mapSettings.getBoardWidth() * mapSettings.getBoardHeight()];
IHex[] nb = new IHex[mapSettings.getBoardWidth() * mapSettings.getBoardHeight()];
    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(),                elevationMap,                mapSettings.getAlgorithmToUse());                Hex[] nb = new Hex[mapSettings.getBoardWidth() * mapSettings.getBoardHeight()];        int index = 0;        for (int h = 0; h < mapSettings.getBoardHeight(); h++) {            for (int w = 0; w < mapSettings.getBoardWidth(); w++) {                nb[index++] = new Hex(elevationMap[w][h],"","");            }        }                IBoard result = new Board(mapSettings.getBoardWidth(),mapSettings.getBoardHeight(), nb);        /* initalize reverseHex */        HashMap reverseHex = new HashMap(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));            }        }                /* Add the woods */        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);        }        /* Add the water */        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);        }                /* Add the rough */        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);        }        /* Add the craters */        if (Compute.randomInt(100) < mapSettings.getProbCrater()) {            addCraters(result, mapSettings.getMinRadius(), mapSettings.getMaxRadius(),                    (int)(mapSettings.getMinCraters()*sizeScale),                    (int)(mapSettings.getMaxCraters()*sizeScale));        }                /* Add the river */        if (Compute.randomInt(100)<mapSettings.getProbRiver()) {            addRiver(result, reverseHex);        }                /* Add the road */        if (Compute.randomInt(100)<mapSettings.getProbRoad()) {            addRoad(result, reverseHex);        }        return result;    }