public static int[][] read() throws IOException {
		List<int[]> board = new ArrayList<int[]>();

		BufferedReader bufferedReader = new BufferedReader(
				new InputStreamReader(System.in));

		String line;
		while ((line = bufferedReader.readLine()) != null) {
			String[] places = line.split(" ");

			int[] row = new int[places.length];
			for (int i = 0; i < places.length; i++) {
				try {
					row[i] = Integer.parseInt(places[i]);
				} catch (NumberFormatException nfe) {
					throw new BadBoardException(nfe);
				}

				if (!(row[i] == 0 || row[i] == 1)) {
					throw new BadBoardException(
							"Values on the board can only be 0 or 1.");
				}
			}
			board.add(row);
		}

		if (board.size() == 0) {
			throw new BadBoardException("The board must be at least 1x1.");
		} else {
			int rowLength = board.get(0).length;
			for (int[] row : board) {
				if (row.length != rowLength) {
					throw new BadBoardException(
							"The board must be rectangular.");
				}
			}
		}

		return board.toArray(new int[board.size()][board.get(0).length]);
	}