Skip to content

Commit

Permalink
Merge pull request #135 from benjaminpjones/score-estimator-cleanup
Browse files Browse the repository at this point in the history
Clean up ScoreEstimator.ts
  • Loading branch information
anoek authored Oct 30, 2023
2 parents c861d03 + 0d30b30 commit 74c1e28
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 346 deletions.
22 changes: 0 additions & 22 deletions src/GoEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,28 +681,6 @@ export class GoEngine extends EventEmitter<Events> {
if (config.removed) {
removed = this.decodeMoves(config.removed);
}
if (
CLIENT &&
!this.territory_included_in_sgf &&
typeof config.removed === "undefined" &&
config.original_sgf &&
/[0-9.]+/.test(self.outcome)
) {
// Game data for SGF uploaded games don't always include removed stones, so we use score
// estimator to find probably dead stones to get a closer approximation of what
// territories should be marked in the final board position.
//
// NOTE: Some Go clients (not OGS, at least for now) do include dead stones in their
// SGFs, which we respect if present and skip using the score estimator.
const se = new ScoreEstimator(
this.goban_callback,
this,
AUTOSCORE_TRIALS,
AUTOSCORE_TOLERANCE,
true,
);
removed = this.decodeMoves(se.getProbablyDead());
}
if (removed) {
for (let i = 0; i < removed.length; ++i) {
this.setRemoved(removed[i].x, removed[i].y, true, false);
Expand Down
2 changes: 1 addition & 1 deletion src/GobanCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ export class GobanCanvas extends GobanCore {

if (this.scoring_mode && this.score_estimate) {
const se = this.score_estimate;
const est = se.heat[j][i];
const est = se.ownership[j][i];

ctx.beginPath();

Expand Down
Loading

0 comments on commit 74c1e28

Please sign in to comment.