From f92d56d6d5760bc2b2dc4159a18b27fb735e51b0 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sun, 29 Mar 2020 16:16:24 +0200 Subject: [PATCH] Fix Omegachess computer play --- client/src/variants/Omega.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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; + } }; -- 2.44.0