private int getHeading(int x, int y, int edgeNumber) {
		int heading = -1;
		if (edgeNumber == 0) {
			if (x == 0) {
				return 1;
			} else {
				return 3;
			}
		} else if (edgeNumber == 1) {
			if (y == 0) {
				return 0;
			} else {
				return 2;
			}
		} else if (edgeNumber == 2) {
			if (x == 1) {
				return 1;
			} else {
				return 3;
			}
		} else if (edgeNumber == 3) {
			if (y == 0) {
				return 0;
			} else {
				return 2;
			}
		}
		return heading;
	}