public static TerrainMap createFromFile() {
		BufferedImage img = null;
		try {
			img = ImageIO.read(TerrainMap.class
					.getResource("/resources/map1.png"));
		} catch (IOException ioEx) {
			ioEx.printStackTrace();
		}
		if (img.getWidth() < DX || img.getHeight() < DY) {
			throw new RuntimeException("map image is not large enough");
		}
		TerrainMap that = new TerrainMap();
		final int len = DX * DY;
		that.ar = new Terrain[len];
		int i = 0;
		for (int y = 0; y < DY; ++y) {
			for (int x = 0; x < DX; ++x) {
				int c = img.getRGB(x, y);
				switch (c & 0xffffff) {
				case 0xffff00:
					that.ar[i] = new Desert(x, y);
					break;
				case 0x00ff0c:
					that.ar[i] = new Plain(x, y);
					break;
				case 0xea0000:
					that.ar[i] = new Mountain(x, y);
					break;
				case 0x024c00:
					that.ar[i] = new Forest(x, y);
					break;
				default:
					throw new RuntimeException(String.format(
							"Unknown value at (%d,%d) %x", x, y, c));
				}
				++i;
			}
		}
		return that;
	}