|
@@ -389,11 +389,12 @@ pub fn negamax(game: &mut Board, sc: &mut SearchControl, hash: &mut Cache, mut a
|
|
if depth == 0 {
|
|
if depth == 0 {
|
|
// check extend
|
|
// check extend
|
|
if check {
|
|
if check {
|
|
- depth = 1;
|
|
|
|
|
|
+ //depth = 1;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- return quiescence_search(game, sc, hash, alpha, beta, 9);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+ return quiescence_search(game, sc, hash, alpha, beta, 9);
|
|
}
|
|
}
|
|
|
|
|
|
sc.nodes += 1;
|
|
sc.nodes += 1;
|
|
@@ -555,7 +556,7 @@ fn quiescence_search(board: &mut Board, sc: &mut SearchControl, hash: &mut Cache
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- let last_move = sc.last_move;
|
|
|
|
|
|
+ let _last_move = sc.last_move;
|
|
|
|
|
|
if board.get_piece(KING, board.turn) == 0 { return checkmated(); }
|
|
if board.get_piece(KING, board.turn) == 0 { return checkmated(); }
|
|
|
|
|
|
@@ -563,13 +564,14 @@ fn quiescence_search(board: &mut Board, sc: &mut SearchControl, hash: &mut Cache
|
|
|
|
|
|
let val = evaluate(board);
|
|
let val = evaluate(board);
|
|
|
|
|
|
|
|
+ // TODO handle checks better
|
|
if !check {
|
|
if !check {
|
|
if val >= beta {
|
|
if val >= beta {
|
|
return beta;
|
|
return beta;
|
|
}
|
|
}
|
|
- if val > alpha {
|
|
|
|
- alpha = val;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if val > alpha {
|
|
|
|
+ alpha = val;
|
|
}
|
|
}
|
|
|
|
|
|
if depth <= 0 {
|
|
if depth <= 0 {
|