Add depth limit on quiescence, add node/timer measurements

This commit is contained in:
stefiosif
2024-10-16 21:36:48 +03:00
parent b2df931d48
commit ff6bbafc50
6 changed files with 64 additions and 25 deletions

View File

@@ -10,7 +10,7 @@ use crate::movegen::move_generator::{
bishop_pseudo_moves, king_pseudo_moves, knight_pseudo_moves, pawn_pseudo_moves,
queen_pseudo_moves, rook_pseudo_moves,
};
use crate::movegen::r#move::{Move, Promote};
use crate::movegen::r#move::{Move, MoveType, Promote};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Board {
@@ -120,6 +120,18 @@ impl Board {
moves
}
pub fn pseudo_moves_all_captures(&self) -> Vec<Move> {
self.pseudo_moves_all()
.into_iter()
.filter(|m| {
matches!(
m.move_type,
MoveType::Capture | MoveType::PromotionCapture(_)
)
})
.collect()
}
pub fn pseudo_moves(&self, color: Color, piece_type: PieceType) -> Vec<Move> {
let all_occupancies = self.all_occupancies();
let (pieces, opponent_occupancies, own_occupancies) = match color {

View File

@@ -89,9 +89,13 @@ mod tests {
init_attacks();
let mut game = from_fen(FEN)?;
let mut tt = TranspositionTable::new(1000000);
let mut nodes = 0;
let time_now = std::time::Instant::now();
// fill Transposition Table
search::negamax::negamax(&mut game, MIN_SCORE, MAX_SCORE, 2, 0, &mut tt);
search::negamax::negamax(&mut game, MIN_SCORE, MAX_SCORE, 4, 0, &mut tt, &mut nodes);
dbg!(nodes);
dbg!(time_now.elapsed());
let will_be_hash = from_fen(FEN_WILL_BE)?.hash;
let tt_entry = tt.lookup(will_be_hash);