IPVGO: Remove unneeded functions from boardState.ts (#1270)

This commit is contained in:
David Walker
2024-05-16 12:26:18 -07:00
committed by GitHub
parent b7962ad8ab
commit 38d99ff15e
7 changed files with 38 additions and 66 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ import { newOpponentStats } from "../Constants";
import { getAllChains, getPlayerNeighbors } from "./boardAnalysis";
import { getKomi } from "./goAI";
import { getDifficultyMultiplier, getMaxFavor, getWinstreakMultiplier } from "../effects/effect";
import { floor, isNotNull } from "../boardState/boardState";
import { isNotNullish } from "../boardState/boardState";
import { Factions } from "../../Faction/Factions";
import { getEnumHelper } from "../../utils/EnumHelper";
import { Go } from "../Go";
@@ -59,7 +59,7 @@ export function endGoGame(boardState: BoardState) {
if (score[GoColor.black].sum < score[GoColor.white].sum) {
resetWinstreak(boardState.ai, true);
statusToUpdate.nodePower += floor(score[GoColor.black].sum * 0.25);
statusToUpdate.nodePower += Math.floor(score[GoColor.black].sum * 0.25);
} else {
statusToUpdate.wins++;
statusToUpdate.oldWinStreak = statusToUpdate.winStreak;
@@ -114,7 +114,7 @@ export function resetWinstreak(opponent: GoOpponent, gameComplete: boolean) {
*/
function getColoredPieceCount(boardState: BoardState, color: GoColor) {
return boardState.board.reduce(
(sum, row) => sum + row.filter(isNotNull).filter((point) => point.color === color).length,
(sum, row) => sum + row.filter(isNotNullish).filter((point) => point.color === color).length,
0,
);
}