Skip to content

Commit 701040e

Browse files
authored
fix: last log entry twice (#860)
1 parent 138d380 commit 701040e

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

kaggle_environments/envs/open_spiel_env/games/go/visualizer/v2/src/components/GameOver.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ export default function GameOver() {
4040
if (!game.gameOver) return null;
4141

4242
const state = game.currentState();
43-
const winnerPlayer = step.players.find((player) => player.reward === 1);
44-
const winnerColor = winnerPlayer?.id === 0 ? 'black' : 'white';
43+
const points = game.score();
44+
const winnerColor = points.black > points.white ? 'black' : 'white';
4545
const blackName = game.blackName ?? 'Black';
4646
const whiteName = game.whiteName ?? 'White';
4747
const winnerName = winnerColor === 'black' ? blackName : whiteName;
48-
const points = game.score();
4948
const captured = { black: state.whiteStonesCaptured, white: state.blackStonesCaptured };
5049
const passes = { black: state.blackPassStones, white: state.whitePassStones };
5150
const tokens = { black: 0, white: 0 };

kaggle_environments/envs/open_spiel_env/games/go/visualizer/v2/src/transformers/goTransformer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const goTransformer = (environment: any): GoStep[] => {
103103

104104
goSteps.push({
105105
step: goSteps.length,
106-
players: goSteps[goSteps.length - 1].players,
106+
players: extraStepPlayers,
107107
boardState: goSteps[goSteps.length - 1].boardState,
108108
isTerminal: lastReplayStep[0].observation.isTerminal,
109109
winner: deriveWinner(lastReplayStep),

0 commit comments

Comments
 (0)