All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fathzer.chess.utils.evaluators.pesto.EndGamePieceSquareTable Maven / Gradle / Ivy

The newest version!
package com.fathzer.chess.utils.evaluators.pesto;

import com.fathzer.chess.utils.evaluators.AbstractPieceSquareTable;

/** The end game piece square table.
 */
public class EndGamePieceSquareTable extends AbstractPieceSquareTable {
	private static final int[] PIECE_VALUES = { 0, 94, 281, 297, 512,  936,  0};

	private static final int [][] PIECE_POSITION_VALUES = new int[][] {
		// Just to have index equals to piece type codes
		new int[0],
		//pawn
	    new int[]{
	    0,   0,   0,   0,   0,   0,   0,   0,
	    178, 173, 158, 134, 147, 132, 165, 187,
	     94, 100,  85,  67,  56,  53,  82,  84,
	     32,  24,  13,   5,  -2,   4,  17,  17,
	     13,   9,  -3,  -7,  -7,  -8,   3,  -1,
	      4,   7,  -6,   1,   0,  -5,  -1,  -8,
	     13,   8,   8,  10,  13,   0,   2,  -7,
	      0,   0,   0,   0,   0,   0,   0,   0},
	    //knight
	    new int[]{
	    -58, -38, -13, -28, -31, -27, -63, -99,
	    -25,  -8, -25,  -2,  -9, -25, -24, -52,
	    -24, -20,  10,   9,  -1,  -9, -19, -41,
	    -17,   3,  22,  22,  22,  11,   8, -18,
	    -18,  -6,  16,  25,  16,  17,   4, -18,
	    -23,  -3,  -1,  15,  10,  -3, -20, -22,
	    -42, -20, -10,  -5,  -2, -20, -23, -44,
	    -29, -51, -23, -15, -22, -18, -50, -64},
	    //bishop
	    new int[]{
	    -14, -21, -11,  -8, -7,  -9, -17, -24,
	     -8,  -4,   7, -12, -3, -13,  -4, -14,
	      2,  -8,   0,  -1, -2,   6,   0,   4,
	     -3,   9,  12,   9, 14,  10,   3,   2,
	     -6,   3,  13,  19,  7,  10,  -3,  -9,
	    -12,  -3,   8,  10, 13,   3,  -7, -15,
	    -14, -18,  -7,  -1,  4,  -9, -15, -27,
	    -23,  -9, -23,  -5, -9, -16,  -5, -17},
	    //rook
	    new int[]{
	    13, 10, 18, 15, 12,  12,   8,   5,
	    11, 13, 13, 11, -3,   3,   8,   3,
	     7,  7,  7,  5,  4,  -3,  -5,  -3,
	     4,  3, 13,  1,  2,   1,  -1,   2,
	     3,  5,  8,  4, -5,  -6,  -8, -11,
	    -4,  0, -5, -1, -7, -12,  -8, -16,
	    -6, -6,  0,  2, -9,  -9, -11,  -3,
	    -9,  2,  3, -1, -5, -13,   4, -20},
	    //queen
	    new int[]{
	     -9,  22,  22,  27,  27,  19,  10,  20,
	    -17,  20,  32,  41,  58,  25,  30,   0,
	    -20,   6,   9,  49,  47,  35,  19,   9,
	      3,  22,  24,  45,  57,  40,  57,  36,
	    -18,  28,  19,  47,  31,  34,  39,  23,
	    -16, -27,  15,   6,   9,  17,  10,   5,
	    -22, -23, -30, -16, -16, -23, -36, -32,
	    -33, -28, -22, -43,  -5, -32, -20, -41},
	    //king
	    new int[]{
	    -74, -35, -18, -18, -11,  15,   4, -17,
	    -12,  17,  14,  17,  17,  38,  23,  11,
	     10,  17,  23,  15,  20,  45,  44,  13,
	     -8,  22,  24,  27,  26,  33,  26,   3,
	    -18,  -4,  21,  24,  27,  23,   9, -11,
	    -19,  -3,  11,  21,  23,  16,   7,  -9,
	    -27, -11,   4,  13,  14,   4,  -5, -17,
	    -53, -34, -21, -11, -28, -14, -24, -43}
	};
	
	static {
		addPiecesValues(PIECE_POSITION_VALUES, PIECE_VALUES);
	}
	
	/** Constructor.
	 */
	public EndGamePieceSquareTable() {
		super();
	}

	@Override
	protected int get(int piece, int index) {
		return PIECE_POSITION_VALUES[piece][index];
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy