Version 0.8.0

=============
Just before creating the external config file
This commit is contained in:
2006-07-04 01:45:39 +00:00
parent 8a641a6e1e
commit a0ee66638d
7 changed files with 241 additions and 28 deletions

View File

@ -68,11 +68,11 @@ public class Board {
/**
* Importance of real mobility in position evaluation (ie. how many moves can one make compared to the other)
*/
public static final int REAL_MOBILITY_VALUE = 1000; //10;
public static final int REAL_MOBILITY_VALUE = 40; //10;
/**
* Importance of relative mobility (mobility of other pieces that may not be able to play because of a compulsory move)
*/
public static final int RELATIVE_MOBILITY_VALUE = 1000; //5;
public static final int RELATIVE_MOBILITY_VALUE = 40; //5;
//with less than that many pawns on one side, the computer will enter endgame mode
public static final int ENDGAME_PAWNS = 3;
@ -81,14 +81,22 @@ public class Board {
public static final int ENDGAME_PIECES = 8;
public static final int[] SQUARE_WEIGHT = {
-20, -10, -10, -10, -10, -10, -10, -20,
/* -20, -10, -10, -10, -10, -10, -10, -20,
-10, 0, 3, 5, 5, 3, 0, -10,
-10, 2, 15, 15, 15, 15, 2, -10,
-10, 7, 15, 25, 25, 15, 7, -10,
-10, 7, 15, 25, 25, 15, 7, -10,
-10, 2, 15, 15, 15, 15, 2, -10,
-10, 0, 3, 5, 5, 3, 0, -10,
-20, -10, -10, -10, -10, -10, -10, -20
-20, -10, -10, -10, -10, -10, -10, -20*/
10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10
};
@ -621,7 +629,7 @@ public class Board {
//this is a very very basic evaluation function that will be changed.
//boardValue = numberOfBlackPieces - numberOfWhitePieces;
boardValue = 0;
if((numberOfPieces[Piece.BLACK_PAWN] <= ENDGAME_PAWNS) || (numberOfPieces[Piece.WHITE_PAWN] <= ENDGAME_PAWNS)
/*if((numberOfPieces[Piece.BLACK_PAWN] <= ENDGAME_PAWNS) || (numberOfPieces[Piece.WHITE_PAWN] <= ENDGAME_PAWNS)
|| (numberOfPieces[Piece.BLACK_PIECES] <= ENDGAME_PIECES) || (numberOfPieces[Piece.WHITE_PIECES] <= ENDGAME_PIECES) ) {
//System.out.println("Playing endgame");
for (int i = Piece.OFFSET; i<=Piece.MAX_PIECE_NUMBER; i++) {
@ -629,17 +637,18 @@ public class Board {
}
} else {
//System.out.println("Playing midgame");
for (int i = Piece.OFFSET; i<=Piece.MAX_PIECE_NUMBER; i++) {
//boardValue += numberOfPieces[i]*Piece.PIECE_VALUE_MIDDLEGAME[i];
for(int squareNb = 0; squareNb<NB_OF_SQUARES; squareNb++) {
Piece pieceOnSquare = getPiece(new Square(squareNb));
if(pieceOnSquare.getPieceNumber()!=Piece.NONE) {
boardValue += SQUARE_WEIGHT[squareNb]*Piece.PIECE_VALUE_MIDDLEGAME[pieceOnSquare.getColor()];
}
/*for (int i = Piece.OFFSET; i<=Piece.MAX_PIECE_NUMBER; i++) {
boardValue += numberOfPieces[i]*Piece.PIECE_VALUE_MIDDLEGAME[i];
}*/
for(int squareNb = 0; squareNb<NB_OF_SQUARES; squareNb++) {
Piece pieceOnSquare = getPiece(new Square(squareNb));
if(pieceOnSquare.getPieceNumber()!=Piece.NONE) {
//System.out.println(SQUARE_WEIGHT[squareNb]);
boardValue += SQUARE_WEIGHT[squareNb]*Piece.PIECE_VALUE_MIDDLEGAME[pieceOnSquare.getPieceNumber()];
}
}
boardValue += ((mobility(Piece.WHITE)-mobility(Piece.BLACK)));
}
//boardValue += ((mobility(Piece.WHITE)-mobility(Piece.BLACK)));
//}
}
}
if (!Rules.isThereALegalMovesForPlayer(this)) {