diff --git a/package.json b/package.json index b7d6f76128..c4e817af7c 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "express": "^4.19.2", "express-http-proxy": "^2.0.0", "fork-ts-checker-webpack-plugin": "^9.0.0", - "goban": "=0.7.44", + "goban": "=0.7.46", "gulp": "^5.0.0", "gulp-clean-css": "^4.3.0", "gulp-eslint-new": "^2.0.0", diff --git a/src/lib/misc.ts b/src/lib/misc.ts index e40dcf8908..1d847115b7 100644 --- a/src/lib/misc.ts +++ b/src/lib/misc.ts @@ -187,7 +187,7 @@ export function getOutcomeTranslation(outcome: string) { } if (outcome.indexOf("Server Decision") === 0) { - return pgettext("Game outcome", "Server Decision") + " " + outcome.substring(16); + return pgettext("Game outcome", "Server Decision"); } if (/[0-9.]+/.test(outcome)) { diff --git a/src/views/Game/Game.tsx b/src/views/Game/Game.tsx index 901e63eeb8..76dc82bfb1 100644 --- a/src/views/Game/Game.tsx +++ b/src/views/Game/Game.tsx @@ -1251,8 +1251,17 @@ export function Game(): JSX.Element | null { engine.outcome !== "Cancellation" && goban.current!.mode === "play" ) { - const s = engine.computeScore(false); - goban.current!.showScores(s); + if ( + engine.phase === "finished" && + engine.outcome.indexOf("Server Decision") === 0 + ) { + if (engine.stalling_score_estimate) { + goban.current!.showStallingScoreEstimate(engine.stalling_score_estimate); + } + } else { + const s = engine.computeScore(false); + goban.current!.showScores(s); + } } }; diff --git a/src/views/Game/PlayControls.styl b/src/views/Game/PlayControls.styl index 1d350acf00..0a0e0bada8 100644 --- a/src/views/Game/PlayControls.styl +++ b/src/views/Game/PlayControls.styl @@ -133,4 +133,12 @@ bottom: 0.5em; */ } + + .stalling-score-estimate { + margin: 0.5rem; + font-size: 1.0rem; + font-style: italic; + text-wrap: balance; + text-wrap-mode: balance; + } } \ No newline at end of file diff --git a/src/views/Game/PlayControls.tsx b/src/views/Game/PlayControls.tsx index 5d296f6e02..6ae6e4e43a 100644 --- a/src/views/Game/PlayControls.tsx +++ b/src/views/Game/PlayControls.tsx @@ -252,6 +252,8 @@ export function PlayControls({ return false; }; + const sse = engine.stalling_score_estimate; + return (
@@ -293,24 +295,48 @@ export function PlayControls({ {(mode === "score estimation" || null) && renderEstimateScore()} {((mode === "play" && phase === "finished") || null) && ( - - {winner - ? interpolate( - pgettext("Game winner", "{{color}} wins by {{outcome}}"), - { - // When is winner an id? - color: - (winner as any) === engine.players.black.id || - winner === "black" - ? _("Black") - : _("White"), - outcome: getOutcomeTranslation(engine.outcome), - }, - ) - : interpolate(pgettext("Game winner", "Tie by {{outcome}}"), { - outcome: pgettext("Game outcome", engine.outcome), - })} - + <> + + {winner + ? interpolate( + pgettext("Game winner", "{{color}} wins by {{outcome}}"), + { + // When is winner an id? + color: + (winner as any) === engine.players.black.id || + winner === "black" + ? _("Black") + : _("White"), + outcome: getOutcomeTranslation(engine.outcome), + }, + ) + : interpolate(pgettext("Game winner", "Tie by {{outcome}}"), { + outcome: pgettext("Game outcome", engine.outcome), + })} + + {engine.stalling_score_estimate && sse && ( +
+ + {interpolate( + _( + "The AI has concluded {{color}} will win with {{certainty}}% certainty. This result has been accepted by one or more players", + ), + { + color: + sse.predicted_winner === "black" + ? _("Black") + : _("White"), + certainty: ( + (sse.predicted_winner === "black" + ? sse.win_rate + : 1.0 - sse.win_rate) * 100.0 + ).toFixed(2), + }, + )} + +
+ )} + )}
diff --git a/src/views/Game/PlayerCards.tsx b/src/views/Game/PlayerCards.tsx index 31eee83042..bbf7d4ecf0 100644 --- a/src/views/Game/PlayerCards.tsx +++ b/src/views/Game/PlayerCards.tsx @@ -270,7 +270,8 @@ export function PlayerCard({ goban.mode !== "analyze" && engine.outcome !== "Timeout" && engine.outcome !== "Resignation" && - engine.outcome !== "Cancellation"; + engine.outcome !== "Cancellation" && + !engine.outcome.startsWith("Server Decision"); return (
diff --git a/yarn.lock b/yarn.lock index 44cd7ff8fc..c75986b1d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5939,10 +5939,10 @@ glogg@^2.2.0: dependencies: sparkles "^2.1.0" -goban@=0.7.44: - version "0.7.44" - resolved "https://registry.yarnpkg.com/goban/-/goban-0.7.44.tgz#56b3801d6a14a4ffd2fde0009d17d338d7692abd" - integrity sha512-3bx5UcCftXGM814VKwUTWN1AaowfgAkYFg2CExtwxWwGSP6dG6bcDhnQ+kC/PfMrz3m+DRKae5qNTbNyTP5UAg== +goban@=0.7.45: + version "0.7.45" + resolved "https://registry.yarnpkg.com/goban/-/goban-0.7.45.tgz#d63f025fded096331594aa9e264d010e3888814f" + integrity sha512-f53uItDIsl8v0p7KdyYBXXo9ts6p8FbBE++hYIwxNuKCGtzPxQGTDc+CGHmgOVFqzJwgsopGF3JoXn9Co5SpvQ== dependencies: eventemitter3 "^5.0.0"