package mitzi;

public final class FigureHelper {

	public static final int WHITE = 0;
	public static final int BLACK = 10;

	public static final int PAWN = 1;
	public static final int ROOK = 2;
	public static final int KNIGHT = 3;
	public static final int BISHOP = 4;
	public static final int QUEEN = 5;
	public static final int KING = 6;

	private FigureHelper() {
	};

	public static int figureValue(final int figureType, final int figureColor) {
		return (figureType + figureColor);
	}

	public static int figureColor(final int figureValue) {
		return (figureValue / 10) * 10;
	}

	public static int figureType(final int figureValue) {
		return figureValue % 10;
	}

	public static boolean isWhite(final int figureValue) {
		return figureColor(figureValue) == WHITE;
	}

	public static boolean isBlack(final int figureValue) {
		return figureColor(figureValue) == BLACK;
	}

	public static int oppositeFigureColor(final int figureValue) {
		return Math.abs(figureColor(figureValue) - 10);
	}

}

@@ -334,16 +334,102 @@
 G = 6;%0A%0A
+%09public static final String%5B%5D ALGEBRAIC_NAMES = %7B %22P%22, %22R%22, %22N%22, %22B%22, %22Q%22,%0A%09%09%09%22K%22 %7D;%0A%0A
 %09private
@@ -1076,10 +1076,383 @@
 0);%0A%09%7D%0A%0A
+%09public static String toString(final int figureValue) %7B%0A%09%09return ALGEBRAIC_NAMES%5BfigureType(figureValue) - 1%5D;%0A%09%7D%0A%0A%09public static String toString(final int figureValue,%0A%09%09%09final boolean omitPawnLetter) %7B%0A%09%09int figure_type = figureType(figureValue);%0A%09%09if (omitPawnLetter && figure_type == PAWN) %7B%0A%09%09%09return %22%22;%0A%09%09%7D else %7B%0A%09%09%09return ALGEBRAIC_NAMES%5Bfigure_type - 1%5D;%0A%09%09%7D%0A%09%7D%0A%0A
 %7D%0A

return algebraic notation name of figure