|
@@ -170,7 +170,7 @@ fn king_safety(game: &Game, side: Side) -> PosValue {
|
|
|
|
|
|
let backrow = if king & (ROW_1 | ROW_8) != 0 { 50 } else { 0 };
|
|
let backrow = if king & (ROW_1 | ROW_8) != 0 { 50 } else { 0 };
|
|
|
|
|
|
- let kneighbors = guards.count_ones() as PosValue * 5 - attackers.count_ones() as PosValue * 15;
|
|
|
|
|
|
+ let kneighbors = guards.count_ones() as PosValue * 8 - attackers.count_ones() as PosValue * 15;
|
|
|
|
|
|
let enemies = game.get_all_side(!side);
|
|
let enemies = game.get_all_side(!side);
|
|
|
|
|
|
@@ -201,8 +201,10 @@ pub fn evaluate(game: &Game) -> PosValue {
|
|
let castling_rights = castling_rights(game, game.turn) - castling_rights(game, !game.turn);
|
|
let castling_rights = castling_rights(game, game.turn) - castling_rights(game, !game.turn);
|
|
|
|
|
|
let pawn_structure = pawn_structure(game, game.turn) - pawn_structure(game, !game.turn);
|
|
let pawn_structure = pawn_structure(game, game.turn) - pawn_structure(game, !game.turn);
|
|
|
|
+ let bishop_moves = (bishop_moves(game, game.turn) - bishop_moves(game, !game.turn)) * 5;
|
|
|
|
+ let queen_moves = (queen_moves(game, game.turn) - queen_moves(game, !game.turn)) * 5;
|
|
|
|
|
|
- let mge = sv + kv + king_safety + king_there + castling_rights + pawn_structure;
|
|
|
|
|
|
+ let mge = sv + kv + king_safety + king_there + castling_rights + pawn_structure + bishop_moves + queen_moves;
|
|
let lge = late_game_eval(game);
|
|
let lge = late_game_eval(game);
|
|
|
|
|
|
let lateness = game_lateness(game);
|
|
let lateness = game_lateness(game);
|
|
@@ -225,10 +227,12 @@ pub fn game_lateness(game: &Game) -> i32 {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+///
|
|
|
|
+/// counts the number of moves the rooks of side can do
|
|
|
|
+///
|
|
fn rook_moves(game: &Game, side: Side) -> PosValue {
|
|
fn rook_moves(game: &Game, side: Side) -> PosValue {
|
|
let rooks = game.rooks(side);
|
|
let rooks = game.rooks(side);
|
|
let rook_moves = count_sliding_move_bitboard(
|
|
let rook_moves = count_sliding_move_bitboard(
|
|
- game,
|
|
|
|
game.get_all_side(side),
|
|
game.get_all_side(side),
|
|
game.get_all_side(!side),
|
|
game.get_all_side(!side),
|
|
rooks,
|
|
rooks,
|
|
@@ -238,6 +242,36 @@ fn rook_moves(game: &Game, side: Side) -> PosValue {
|
|
return rook_moves as _;
|
|
return rook_moves as _;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+///
|
|
|
|
+/// counts the number of moves the bishops of side can do
|
|
|
|
+///
|
|
|
|
+fn bishop_moves(game: &Game, side: Side) -> PosValue {
|
|
|
|
+ let bishops = game.bishops(side);
|
|
|
|
+ let bishop_moves = count_sliding_move_bitboard(
|
|
|
|
+ game.get_all_side(side),
|
|
|
|
+ game.get_all_side(!side),
|
|
|
|
+ bishops,
|
|
|
|
+ false, true,
|
|
|
|
+ false);
|
|
|
|
+
|
|
|
|
+ return bishop_moves as _;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+///
|
|
|
|
+/// counts the number of moves the queens of side can do
|
|
|
|
+///
|
|
|
|
+fn queen_moves(game: &Game, side: Side) -> PosValue {
|
|
|
|
+ let queens = game.queens(side);
|
|
|
|
+ let queen_moves = count_sliding_move_bitboard(
|
|
|
|
+ game.get_all_side(side),
|
|
|
|
+ game.get_all_side(!side),
|
|
|
|
+ queens,
|
|
|
|
+ true, true,
|
|
|
|
+ false);
|
|
|
|
+
|
|
|
|
+ return queen_moves as _;
|
|
|
|
+}
|
|
|
|
+
|
|
pub fn late_game_eval(game: &Game) -> PosValue {
|
|
pub fn late_game_eval(game: &Game) -> PosValue {
|
|
let pp = pawn_push_value(game, game.turn) - pawn_push_value(game, !game.turn);
|
|
let pp = pawn_push_value(game, game.turn) - pawn_push_value(game, !game.turn);
|
|
let bp = blocked_pawns(game, game.turn) - blocked_pawns(game, !game.turn);
|
|
let bp = blocked_pawns(game, game.turn) - blocked_pawns(game, !game.turn);
|