first commit

This commit is contained in:
unknown
2023-01-27 20:50:01 +08:00
commit a5e17d8c5d
69 changed files with 12547 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import { evaluateBoard } from './evaluate-board';
export function quiescenceSearch(board, alpha, beta) {
const baseE = evaluateBoard(board);
if (baseE >= beta) return beta;
alpha = Math.max(baseE, alpha);
for (const move of board.moves) {
if (move.captures.length <= 0) continue;
const nextBoard = board.doMove(move);
const e = -quiescenceSearch(nextBoard, -beta, -alpha);
if (e >= beta) return beta;
alpha = Math.max(e, alpha);
}
return alpha;
}