IPVGO: Fix scoring of very large open areas (#2464)

This commit is contained in:
Michael Ficocelli
2026-02-03 07:52:40 -05:00
committed by GitHub
parent 00339a206c
commit ba1c6f3818
2 changed files with 3 additions and 5 deletions

View File

@@ -116,10 +116,10 @@ export function evaluateMoveResult(board: Board, x: number, y: number, player: G
export function getControlledSpace(board: Board) {
const chains = getAllChains(board);
const length = board[0].length;
const whiteControlledEmptyNodes = getAllPotentialEyes(board, chains, GoColor.white, length * 2)
const whiteControlledEmptyNodes = getAllPotentialEyes(board, chains, GoColor.white, 99)
.map((eye) => eye.chain)
.flat();
const blackControlledEmptyNodes = getAllPotentialEyes(board, chains, GoColor.black, length * 2)
const blackControlledEmptyNodes = getAllPotentialEyes(board, chains, GoColor.black, 99)
.map((eye) => eye.chain)
.flat();

View File

@@ -141,9 +141,7 @@ function getColoredPieceCount(boardState: BoardState, color: GoColor) {
* Finds all empty spaces fully surrounded by a single player's stones
*/
function getTerritoryScores(board: Board) {
const emptyTerritoryChains = getAllChains(board).filter(
(chain) => chain?.[0]?.color === GoColor.empty && chain.length <= board.length * 2,
);
const emptyTerritoryChains = getAllChains(board).filter((chain) => chain?.[0]?.color === GoColor.empty);
return emptyTerritoryChains.reduce(
(scores, currentChain) => {