package mitzi;

public enum Direction {
	EAST(10, 21), NORTHEAST(11, 12), NORTH(1, -8), NORTHWEST(-9, -19), WEST(
			-10, -21), SOUTHWEST(-11, -12), SOUTH(-1, 8), SOUTHEAST(9, 19);

	/**
	 * Add to a square value to go one step in the specified direction.
	 * 
	 * White is South, Black is North.
	 */
	public final int offset;

	/**
	 * Add to a square value to go one knight-step in the specified direction.
	 * 
	 * One up and two right is East. Two up one right is Northeast. Basically,
	 * the orientation is shifted a bit counterclockwise.
	 */
	public final int knight_offset;

	Direction(int offset, int knight_offset) {
		this.offset = offset;
		this.knight_offset = knight_offset;
	}

}

@@ -9,16 +9,43 @@
 mitzi;%0A%0A
+import java.util.EnumSet;%0A%0A
 public e
@@ -715,10 +715,795 @@
 et;%0A%09%7D%0A%0A
+%09/**%0A%09 * Returns the direction in which a pawn of the specified color can move%0A%09 * (without capturing).%0A%09 * %0A%09 * @param color%0A%09 *            the color of the piece%0A%09 * @return NORTH for white and SOUTH for black%0A%09 */%0A%09public static Direction pawnDirection(int color) %7B%0A%09%09if (color == PieceHelper.WHITE) %7B%0A%09%09%09return NORTH;%0A%09%09%7D else %7B%0A%09%09%09return SOUTH;%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Returns a set of directions in which a pawn of the specified color can%0A%09 * capture other pieces.%0A%09 * %0A%09 * @param color%0A%09 *            the color of the piece%0A%09 * @return the set of directions allowed%0A%09 */%0A%09public static EnumSet%3CDirection%3E pawnCapturingDirections(int color) %7B%0A%09%09if (color == PieceHelper.WHITE) %7B%0A%09%09%09return EnumSet.of(NORTHEAST, NORTHWEST);%0A%09%09%7D else %7B%0A%09%09%09return EnumSet.of(SOUTHEAST, SOUTHWEST);%0A%09%09%7D%0A%09%7D%0A%0A
 %7D%0A

make directions color-aware