From 7dc0cfd0629f2278bc35702af19639da1ec80417 Mon Sep 17 00:00:00 2001 From: Christopher D'Mello Date: Thu, 20 Nov 2025 22:30:58 +0000 Subject: [PATCH 1/2] all-in showdown --- .../v2/repeatedPokerTransformerV2.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts b/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts index 6d6cc7c6..ae5dbabb 100644 --- a/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts +++ b/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts @@ -71,7 +71,14 @@ export const getPokerStepRenderTime = ( export const getPokerStepInterestingEvents = (gameSteps: RepeatedPokerStep[]): InterestingEvent[] => { const interestingEvents: InterestingEvent[] = []; - const largePotIndices = new Set(gameSteps.filter((s) => s.pot >= 300).map((s) => s.currentHandIndex)); + const largePotIndices = new Set( + gameSteps + .filter((s) => { + return s.pot >= 300 && s.pot < 400; + }) + .map((s) => s.currentHandIndex) + ); + const showdownIndices = new Set(gameSteps.filter((s) => s.pot === 400).map((s) => s.currentHandIndex)); let lastHandIndex = -1; for (const step of gameSteps) { @@ -82,6 +89,12 @@ export const getPokerStepInterestingEvents = (gameSteps: RepeatedPokerStep[]): I description: `Big Pot`, }); } + if (showdownIndices.has(step.currentHandIndex)) { + interestingEvents.push({ + step: step.step, + description: `All-in Showdown`, + }); + } lastHandIndex = step.currentHandIndex; } } From ac07df12c40156da46ef9b4c06530db1317fa335 Mon Sep 17 00:00:00 2001 From: Christopher D'Mello Date: Fri, 21 Nov 2025 00:11:53 +0000 Subject: [PATCH 2/2] check for high hands and upsets` --- .../v2/repeatedPokerTransformerV2.ts | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts b/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts index ae5dbabb..43e368e1 100644 --- a/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts +++ b/web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerV2.ts @@ -1,7 +1,7 @@ import { defaultGetStepRenderTime } from '../../../timing'; import { InterestingEvent, ReplayMode } from '../../../types'; import { PokerReplay, PokerReplayStepHistoryParsed } from './poker-replay-types'; -import { RepeatedPokerStep } from './poker-steps-types'; +import { RepeatedPokerStep, RepeatedPokerStepPlayer } from './poker-steps-types'; import { createVisualStepsFromRepeatedPokerReplay } from './repeatedPokerTransformerUtils'; @@ -70,11 +70,13 @@ export const getPokerStepRenderTime = ( }; export const getPokerStepInterestingEvents = (gameSteps: RepeatedPokerStep[]): InterestingEvent[] => { + console.log(gameSteps); + const interestingEvents: InterestingEvent[] = []; const largePotIndices = new Set( gameSteps .filter((s) => { - return s.pot >= 300 && s.pot < 400; + return s.pot >= 350 && s.pot < 400; }) .map((s) => s.currentHandIndex) ); @@ -82,17 +84,42 @@ export const getPokerStepInterestingEvents = (gameSteps: RepeatedPokerStep[]): I let lastHandIndex = -1; for (const step of gameSteps) { + const hasLargePot = largePotIndices.has(step.currentHandIndex); + const hasShowdown = showdownIndices.has(step.currentHandIndex); + + // Check for high hands + const highHandTypes = ['Full House', 'Four of a Kind', 'Straight Flush', 'Royal Flush']; + const handSteps = gameSteps.filter((s) => s.currentHandIndex === step.currentHandIndex); + const hasHighHand = handSteps.some((s) => s.bestHandRankTypes?.some((rank) => highHandTypes.includes(rank))); + + // Check for upsets (winner had < 20% odds on turn or river) + const turnOrRiverStep = handSteps.find((s) => s.stepType === 'deal-turn' || s.stepType === 'deal-river'); + const winnerIndex = + handSteps + .find((s) => s.stepType === 'final') + ?.players.findIndex((p) => (p as RepeatedPokerStepPlayer).isWinner) ?? -1; + const hasUpset = turnOrRiverStep && turnOrRiverStep.winOdds && turnOrRiverStep.winOdds[winnerIndex * 2] < 0.2; + if (step.currentHandIndex > lastHandIndex) { - if (largePotIndices.has(step.currentHandIndex)) { + if (hasUpset) { interestingEvents.push({ step: step.step, - description: `Big Pot`, + description: 'Upset', }); - } - if (showdownIndices.has(step.currentHandIndex)) { + } else if (hasHighHand) { + interestingEvents.push({ + step: step.step, + description: 'High Hand', + }); + } else if (hasLargePot) { + interestingEvents.push({ + step: step.step, + description: 'Big Pot', + }); + } else if (hasShowdown) { interestingEvents.push({ step: step.step, - description: `All-in Showdown`, + description: 'All-in Showdown', }); } lastHandIndex = step.currentHandIndex;