From: Benjamin Auder Date: Sun, 29 Mar 2020 14:16:24 +0000 (+0200) Subject: Fix Omegachess computer play X-Git-Url: https://git.auder.net/doc/html/pieces/current/git-favicon.png?a=commitdiff_plain;h=f92d56d6d5760bc2b2dc4159a18b27fb735e51b0;p=vchess.git Fix Omegachess computer play --- diff --git a/client/src/variants/Omega.js b/client/src/variants/Omega.js index fa95f5e3..e6826718 100644 --- a/client/src/variants/Omega.js +++ b/client/src/variants/Omega.js @@ -447,4 +447,17 @@ export class OmegaRules extends ChessRules { k: 1000 }; } + + evalPosition() { + let evaluation = 0; + for (let i = 0; i < V.size.x; i++) { + for (let j = 0; j < V.size.y; j++) { + if (![V.EMPTY,V.NOTHING].includes(this.board[i][j])) { + const sign = this.getColor(i, j) == "w" ? 1 : -1; + evaluation += sign * V.VALUES[this.getPiece(i, j)]; + } + } + } + return evaluation; + } };