public boolean canMove(int i, int j, Direction d) throws CellDoesNotExistException {
		checkCellExists(i, j);
		if (isWallUp(i, j, d)) {
			// There is a wall that is blocking us, so we cannot move that way.
			return false;
		} else {
			// No wall, so let's see if we can move that way.
			int i1 = i;
			int j1 = j;
			switch (d) {
			case NORTH:
				i1--;
				break;
			case SOUTH:
				i1++;
				break;
			case WEST:
				j1--;
				break;
			case EAST:
				j1++;
				break;
			}
			// Cell (i1,j1) is the new position. Is it in the maze?
			if (cellExists(i1, j1)) {
				// New position is in the maze. Is it filled?
				if (isFilled(i1, j1)) {
					// Yes, so we cannot move.
					return false;
				} else {
					// No, we can move.
					return true;
				}
			} else {
				// No, the new position is out of the maze. We can then move (an exit!).
				return true;
			}
		}
	}