Android Open Source - android-chess Valuation






From Project

Back to project page android-chess.

License

The source code is released under:

MIT License

If you think the Android project android-chess listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package jwtc.chess;
/*from  w w w .j  av  a 2 s  .  com*/
// Valuation. Wrapper class for evaluation

public class Valuation
{
  public Valuation()
  {
    MPD = 70;
    
    DOUBLED_PAWN = 10;
    PASSED_PAWN = 10;
    CASTLED_KING_POS = 10;
    EARLY_QUEEN = 30;
    CENTER_KNIGHT = 5;
    DEVELOPED_KNIGHT = 2;
    BISHOP_MOVE = 2;
    ROOK_MOVE = 2;
    ROOK_RANK_7 = 10;
    ROOK_OPEN_FILE = 10;
  }
  public void setWeights4Test()
  {
    MPD = 150;
    
    DOUBLED_PAWN = 10*3;
    PASSED_PAWN = 10*3;
    CASTLED_KING_POS = 10*3;
    EARLY_QUEEN = 30*3;
    CENTER_KNIGHT = 5*3;
    DEVELOPED_KNIGHT = 2*3;
    BISHOP_MOVE = 2*3;
    ROOK_MOVE = 2*3;
    ROOK_RANK_7 = 10*3;
    ROOK_OPEN_FILE = 10*3;
  }
  // big bonus for a mate - make sure that no sum of an evaluation can ever get bigger than this value
  public static final int MATE = 10000;
  // zero sum based game, so a draw relates to 0
  public static final int DRAW = 0;
  
  // penalty for repeating moves
  public static int DRAW_REPEAT = -10;

  // value of the pieces
  // The standard 1, 3, 3, 6, 9 from pawn, knight, bishop, rook and queen
  // tuned a little for experimentation
  public static int PIECES[] = {100, 300, 305, 600, 1000, 0};

  public static int TRANSPOSITION_MOVE_SCORE = 2000;
  public static int KILLER_MOVE_SCORE = 1500;

  
  public static int LONE_KING = 6; //6*8=48; best value ending = 48
  public static int LONE_KING_BONUS = 150; // 150 after gnu-chess
  
  
  public static int MPD;
  
  public static int DOUBLED_PAWN;
  public static int PASSED_PAWN;
  public static int CASTLED_KING_POS;
  public static int EARLY_QUEEN;
  public static int CENTER_KNIGHT;
  public static int DEVELOPED_KNIGHT;
  public static int BISHOP_MOVE;
  public static int ROOK_MOVE;
  public static int ROOK_RANK_7;
  public static int ROOK_OPEN_FILE;
  
  //
  public static final long CENTER_4x4_SQUARES = 0x00003C3C3C3C0000L;
  public static final long CENTER_SQUARES = 0x00003C7E7E3C0000L;
  
  // positional values to where a king typically get's mated in an end game. 0 is bad is easily mated.
  // after gnu-chess
  public static final int[] KING_ENDINGS = {
        0,  6, 12, 18, 18, 12,  6,  0,
        6, 12, 18, 24, 24, 18, 12,  6,
        12, 18, 24, 32, 32, 24, 18, 12,
        18, 24, 32, 48, 48, 32, 24, 18,
        18, 24, 32, 48, 48, 32, 24, 18,
        12, 18, 24, 32, 32, 24, 18, 12,
        6, 12, 18, 24, 24, 18, 12,  6,
        0,  6, 12, 18, 18, 12,  6,  0
                       };
  // kbnk score, first index is "square color" of the bishop, second index the position of the losing king
  // after gnu-chess
  public static final int KBNK_SCORE[][] = {
      {
    0, 10, 20, 30, 40, 50, 60, 70,
    10, 20, 30, 40, 50, 60, 70, 60,
    20, 30, 40, 50, 60, 70, 60, 50,
    30, 40, 50, 60, 70, 60, 50, 40,
    40, 50, 60, 70, 60, 50, 40, 30,
    50, 60, 70, 60, 50, 40, 30, 20,
    60, 70, 60, 50, 40, 30, 20, 10,
    70, 60, 50, 40, 30, 20, 10,  0
      },
      {
    70, 60, 50, 40, 30, 20, 10,  0,
    60, 70, 60, 50, 40, 30, 20, 10,
    50, 60, 70, 60, 50, 40, 30, 20,
    40, 50, 60, 70, 60, 50, 40, 30,
    30, 40, 50, 60, 70, 60, 50, 40,
    20, 30, 40, 50, 60, 70, 60, 50,
    10, 20, 30, 40, 50, 60, 70, 60,
    0, 10, 20, 30, 40, 50, 60, 70,
      }
      
  };

}




Java Source Code List

jwtc.android.chess.ChessFieldView.java
jwtc.android.chess.ChessImageView.java
jwtc.android.chess.ChessPreferences.java
jwtc.android.chess.ChessViewBase.java
jwtc.android.chess.ChessView.java
jwtc.android.chess.GamesListView.java
jwtc.android.chess.HtmlActivity.java
jwtc.android.chess.ImageCacheObject.java
jwtc.android.chess.MyBaseActivity.java
jwtc.android.chess.MyPGNProvider.java
jwtc.android.chess.PGNView.java
jwtc.android.chess.SaveGameDlg.java
jwtc.android.chess.UI.java
jwtc.android.chess.convergence.Connection.java
jwtc.android.chess.convergence.ConvergenceActivity.java
jwtc.android.chess.convergence.RestServer.java
jwtc.android.chess.iconifiedlist.IconifiedTextListAdapter.java
jwtc.android.chess.iconifiedlist.IconifiedTextView.java
jwtc.android.chess.iconifiedlist.IconifiedText.java
jwtc.android.chess.ics.CustomCommands.java
jwtc.android.chess.ics.ICSChatDlg.java
jwtc.android.chess.ics.ICSChessView.java
jwtc.android.chess.ics.ICSClient.java
jwtc.android.chess.ics.ICSConfirmDlg.java
jwtc.android.chess.ics.ICSMatchDlg.java
jwtc.android.chess.ics.TelnetSocket.java
jwtc.android.chess.ics.TimesealInputStream.java
jwtc.android.chess.ics.TimesealOutputStream.java
jwtc.android.chess.ics.TimesealPipe.java
jwtc.android.chess.ics.TimesealingSocket.java
jwtc.android.chess.puzzle.ChessViewPractice.java
jwtc.android.chess.puzzle.ChessViewPuzzle.java
jwtc.android.chess.puzzle.MyPuzzleProvider.java
jwtc.android.chess.puzzle.practice.java
jwtc.android.chess.puzzle.puzzle.java
jwtc.android.chess.tools.FileListView.java
jwtc.android.chess.tools.PGNProcessor.java
jwtc.android.chess.tools.importactivity.java
jwtc.android.chess.tools.pgntool.java
jwtc.android.chess.main.java
jwtc.android.chess.options.java
jwtc.android.chess.setup.java
jwtc.android.chess.start.java
jwtc.android.timeseal.TimesealingSocket.java
jwtc.android.timeseal.streams.a.java
jwtc.android.timeseal.streams.b.java
jwtc.android.timeseal.streams.c.java
jwtc.chess.ChessPuzzleProvider.java
jwtc.chess.GameControl.java
jwtc.chess.JNI.java
jwtc.chess.Move.java
jwtc.chess.PGNColumns.java
jwtc.chess.PGNEntry.java
jwtc.chess.PGNProvider.java
jwtc.chess.Pos.java
jwtc.chess.Valuation.java
jwtc.chess.algorithm.SearchAlgorithmRunner.java
jwtc.chess.algorithm.UCIWrapper.java
jwtc.chess.board.BoardConstants.java
jwtc.chess.board.BoardHashKeys.java
jwtc.chess.board.BoardMembers.java
jwtc.chess.board.BoardStatics.java
jwtc.chess.board.ChessBoard.java