Skip to content

Commit

Permalink
Merge pull request #137 from benjaminpjones/score-estimator-more-cleanup
Browse files Browse the repository at this point in the history
Score estimator more cleanup
  • Loading branch information
anoek authored Nov 9, 2023
2 parents c110ad0 + ecf3284 commit 1fb76ef
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/GoEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare const CLIENT: boolean;
declare const SERVER: boolean;

export const AUTOSCORE_TRIALS = 1000;
export const AUTOSCORE_TOLERANCE = 0.3;
export const AUTOSCORE_TOLERANCE = 0.1;

export type GoEnginePhase = "play" | "stone removal" | "finished";
export type GoEngineRules = "chinese" | "aga" | "japanese" | "korean" | "ing" | "nz";
Expand Down
2 changes: 1 addition & 1 deletion src/GobanCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3170,7 +3170,7 @@ export abstract class GobanCore extends EventEmitter<Events> {
this,
this.engine,
AUTOSCORE_TRIALS,
Math.min(0.1, AUTOSCORE_TOLERANCE),
AUTOSCORE_TOLERANCE,
true,
);

Expand Down
5 changes: 0 additions & 5 deletions src/ScoreEstimator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,11 +566,6 @@ export class ScoreEstimator {
} else {
this.white.scoring_positions += encodeMoves(gr.points);
}

console.warn(
"What should be unreached code is running, should probably be running " +
"this[color].territory += markScored(gr.points, false);",
);
}
});
}
Expand Down
7 changes: 3 additions & 4 deletions src/__tests__/GobanCanvas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
(global as any).CLIENT = true;

import { GobanCanvas, GobanCanvasConfig } from "../GobanCanvas";
import { GobanCore } from "../GobanCore";
import { AUTOSCORE_TOLERANCE, AUTOSCORE_TRIALS } from "../GoEngine";
import { GobanCore, SCORE_ESTIMATION_TOLERANCE, SCORE_ESTIMATION_TRIALS } from "../GobanCore";
import { GobanSocket } from "../GobanSocket";
import * as GoMath from "../GoMath";
import WS from "jest-websocket-mock";
Expand Down Expand Up @@ -419,8 +418,8 @@ describe("onTap", () => {

expect(goban.engine.estimateScore).toBeCalledTimes(1);
expect(goban.engine.estimateScore).toBeCalledWith(
AUTOSCORE_TRIALS,
AUTOSCORE_TOLERANCE,
SCORE_ESTIMATION_TRIALS,
SCORE_ESTIMATION_TOLERANCE,
false,
);
(goban.engine.estimateScore as jest.Mock).mockClear();
Expand Down

0 comments on commit 1fb76ef

Please sign in to comment.