Version 7.0

===========
Corrected a few bugs from 6.9, like the principal variation.
About to add opening book.
This commit is contained in:
2006-07-02 13:51:14 +00:00
parent 1b500b4421
commit b02755be4e
6 changed files with 183 additions and 80 deletions

View File

@ -70,6 +70,15 @@ public class Board {
* Value representing the value of a draw position
*/
public static final int DRAW_BOARD = 0;
/**
* 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 = 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 = 5;
/*======*
* DATA *
@ -314,13 +323,9 @@ public class Board {
if(currentPlayer==Piece.WHITE) {
currentPlayer=Piece.BLACK;
//if (SuicideChess.ASCII_GAME)
// System.out.println("Black: ");
} else {
fullmoveNumber++; //black has just played
currentPlayer=Piece.WHITE;
//if (SuicideChess.ASCII_GAME)
// System.out.println("White: ");
}
evaluateNewBoardValue(move);
@ -581,6 +586,19 @@ public class Board {
}
}
//calculates player's mobility
public int mobility(int colour) throws NotAValidSquare {
Board thisCopy = new Board(this);
thisCopy.currentPlayer=colour;
Rules.legalMovesForPlayer(thisCopy);
if (Rules.getLegalMovesCapture().size()!=0) {
return Rules.getLegalMovesCapture().size()*REAL_MOBILITY_VALUE
+Rules.getLegalMovesNonCapture().size()*RELATIVE_MOBILITY_VALUE;
} else {
return Rules.getLegalMovesNonCapture().size()*REAL_MOBILITY_VALUE;
}
}
private void evaluateNewBoardValue (Move move) throws NotAValidSquare {
if (move.isCaptureMove()) {
@ -602,7 +620,8 @@ public class Board {
//System.out.println("Playing midgame");
for (int i = Piece.OFFSET; i<=Piece.MAX_PIECE_NUMBER; i++) {
boardValue += numberOfPieces[i]*Piece.PIECE_VALUE_MIDDLEGAME[i];
}
}
boardValue += ((mobility(Piece.WHITE)-mobility(Piece.BLACK)));
}
}
}