diff --git a/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.ts b/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.ts index da242145..3a7b86ad 100644 --- a/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.ts +++ b/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.ts @@ -693,9 +693,16 @@ export function renderer(options: RendererOptions): void { ? bestFiveCardHands[winnerIndex].match(/.{1,2}/g) || ([] as string[]) : ([] as string[]); + // Check for split pot + let isSplitPot = false; + // If both players are winners, then it's a split pot + if (stepType === 'final' && players.every((p) => (p as RepeatedPokerStepPlayer).isWinner)) { + isSplitPot = true; + } + // Add actual cards for (let i = 0; i < numCards; i++) { - const shouldHighlight = winnerBestHand.includes(communityCardsArray[i]); + const shouldHighlight = !isSplitPot && winnerBestHand.includes(communityCardsArray[i]); elements.communityCardsContainer.appendChild(createCardElement(communityCardsArray[i], false, shouldHighlight)); } @@ -713,18 +720,23 @@ export function renderer(options: RendererOptions): void { // Casting 'basePlayerData' to 'RepeatedPokerStepPlayer' to access properties. const playerData = basePlayerData as RepeatedPokerStepPlayer; + const isWinner = playerData.actionDisplayText !== 'SPLIT POT' && playerData.isWinner; + const isSplitPot = playerData.actionDisplayText === 'SPLIT POT'; + const isAllIn = playerData.actionDisplayText === 'ALL-IN'; + const isTurn = playerData.isTurn; + const playerNameElement = elements.playerNames[index]; if (playerNameElement) { playerNameElement.textContent = playerData.name; - if (playerData.isTurn) { + if (isTurn) { playerNameElement.classList.add('current-turn'); } else { playerNameElement.classList.remove('current-turn'); } // Add winner class if player won - if (playerData.isWinner) { + if (isWinner) { playerNameElement.classList.add('winner'); } else { playerNameElement.classList.remove('winner'); @@ -758,8 +770,8 @@ export function renderer(options: RendererOptions): void { bestFiveCardHands && bestFiveCardHands[index] ? bestFiveCardHands[index].match(/.{1,2}/g) || ([] as string[]) : ([] as string[]); - const shouldHighlightWinningHand = playerData.isWinner && showCards && isShowdown && bestHandArray.length > 0; + const shouldHighlightWinningHand = isWinner && showCards && isShowdown && bestHandArray.length > 0; (playerCardsArray || [null, null]).forEach((cardStr) => { const shouldHighlight = shouldHighlightWinningHand && cardStr && bestHandArray.includes(cardStr); playerCardsContainer.appendChild( @@ -777,14 +789,17 @@ export function renderer(options: RendererOptions): void { const playerInfoArea = elements.playerInfoAreas[index]; if (playerInfoArea) { // Highlight active player's pod - if (playerData.isTurn) { + if (isTurn) { playerInfoArea.classList.add('active-player'); } else { playerInfoArea.classList.remove('active-player'); } + if (isSplitPot) { + playerInfoArea.classList.add('split-pot'); + } // Highlight winner's pod - if (playerData.isWinner) { + if (isWinner) { playerInfoArea.classList.add('winner-player'); } else { playerInfoArea.classList.remove('winner-player'); @@ -797,8 +812,17 @@ export function renderer(options: RendererOptions): void { const betDisplay = playerInfoArea.querySelector('.bet-display') as HTMLElement; if (betDisplay) { - if (playerData.isWinner) { + if (isWinner) { betDisplay.classList.add('winner-player'); + } else if (isSplitPot) { + betDisplay.classList.add('split-pot'); + } else { + if (isTurn) { + betDisplay.classList.add('active-player'); + } + if (isAllIn) { + betDisplay.classList.add('all-in'); + } } if (playerData.currentBet > 0) { if (playerData.actionDisplayText) { @@ -806,7 +830,6 @@ export function renderer(options: RendererOptions): void { } else { betDisplay.textContent = ''; } - betDisplay.style.display = 'block'; } } diff --git a/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/style.css b/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/style.css index 65eb276b..57fbd8b1 100644 --- a/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/style.css +++ b/kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/style.css @@ -166,6 +166,10 @@ border-color: #ffeb70; } +.player-info-area.split-pot { + border-color: #FF5C19; +} + .player-container-0 .player-info-area { flex-direction: column-reverse; } @@ -433,20 +437,36 @@ padding: 10px; border-radius: 30px; background-color: #ffffff; + opacity: 0.7; color: black; font-family: "Inter", sans-serif; font-size: 20px; font-weight: 600; text-align: center; - height: 20pxrem; + height: 20px; line-height: 20px; width: 240px; min-height: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); } +.bet-display.active-player { + opacity: 1; +} + .bet-display.winner-player { background-color: #ffeb70; + opacity: 1; +} + +.bet-display.split-pot { + opacity: 1; + background-color: #FF5C19; +} + +.bet-display.all-in { + color: white; + background-color: #B3261E; } .blind-indicator {