public static void main(final String[] args) {
		if (args.length < 2 || args.length > 3) {
			System.err
					.println("Usage: java PatternDatabaseGenerator <num of tiles> <tile order> [filename]");
			System.exit(1);
		}
		int puzzleSize = 0;
		try {
			puzzleSize = Integer.parseInt(args[0].trim());
			if ((puzzleSize != 8) && (puzzleSize != 15)) {
				System.err.println("Error: Puzzle size must be either 8 or 15.");
				System.exit(1);
			}
			++puzzleSize;
		} catch (final NumberFormatException nfe) {
			System.err.println("Error: Puzzle size must be either 8 or 15.");
			System.exit(1);
		}
		final String tileOrder = args[1].trim();
		final byte[] tiles = new byte[puzzleSize];
		final byte dummyTile = getArray(tileOrder, tiles, puzzleSize);
		System.err.println("Using dummy tile: " + dummyTile);
		String filename = null;
		if (args.length == 3) {
			filename = args[2];
		}
		new PatternDatabaseGenerator(puzzleSize, Utility.byteArrayToLong(tiles), dummyTile,
				filename);
	}