Skip to content

Commit 5d63d13

Browse files
committed
keep player action string as "ALL-IN" during subsequent moves
1 parent 37ba962 commit 5d63d13

File tree

1 file changed

+39
-31
lines changed

1 file changed

+39
-31
lines changed

web/core/src/transformers/repeated_poker/v2/repeatedPokerTransformerUtils.ts

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type StepGenerator = (
2323
const STARTING_STACK_SIZE = 200;
2424
const FIRST_ACTOR_BY_STREET = [1, 0, 0, 0];
2525
const NUM_PLAYERS = 2;
26+
const ALL_IN_STRING = 'ALL-IN';
2627

2728
export function getBettingStringFromACPCState(acpcState: string): string {
2829
if (!acpcState) {
@@ -276,7 +277,7 @@ const createPlayerActionStep = (
276277

277278
let actionDisplayText: string;
278279
if (isAllIn) {
279-
actionDisplayText = 'ALL-IN';
280+
actionDisplayText = ALL_IN_STRING;
280281
} else if (id === actingPlayerId) {
281282
actionDisplayText = activeActionDisplay;
282283
} else {
@@ -687,21 +688,25 @@ const generateCommunityCardStepSequence: StepGenerator = (remainingRawSteps, age
687688
}
688689

689690
// --- Visual Step 1: The "Deal" Step ---
690-
const dealStepPlayers: RepeatedPokerStepPlayer[] = [0, 1].map((id) => ({
691-
id,
692-
name: agents[id].Name,
693-
thumbnail: agents[id].ThumbnailUrl,
694-
cards: stateBeforeAction.current_universal_poker_json.player_hands[id],
695-
chipStack: STARTING_STACK_SIZE - stateBeforeAction.current_universal_poker_json.player_contributions[id],
696-
currentBet: stateBeforeAction.current_universal_poker_json.player_contributions[id],
697-
currentBetForStreet: 0,
698-
reward: null,
699-
actionDisplayText: '',
700-
thoughts: '',
701-
isDealer: preDealStep.dealer === id,
702-
isTurn: false,
703-
isWinner: false,
704-
}));
691+
const dealStepPlayers: RepeatedPokerStepPlayer[] = [0, 1].map((id) => {
692+
const chipStack = STARTING_STACK_SIZE - stateBeforeAction.current_universal_poker_json.player_contributions[id];
693+
694+
return {
695+
id,
696+
name: agents[id].Name,
697+
thumbnail: agents[id].ThumbnailUrl,
698+
cards: stateBeforeAction.current_universal_poker_json.player_hands[id],
699+
chipStack,
700+
currentBet: stateBeforeAction.current_universal_poker_json.player_contributions[id],
701+
currentBetForStreet: 0,
702+
reward: null,
703+
actionDisplayText: chipStack === 0 ? ALL_IN_STRING : '',
704+
thoughts: '',
705+
isDealer: preDealStep.dealer === id,
706+
isTurn: false,
707+
isWinner: false,
708+
}
709+
});
705710

706711
const dealStep: RepeatedPokerStep = {
707712
stepType,
@@ -793,21 +798,24 @@ const generateCommunityCardStepSequence: StepGenerator = (remainingRawSteps, age
793798
bestHandRankTypes: stateForDeal.best_hand_rank_types,
794799
currentPlayer: -1,
795800
currentHandIndex: preDealStep.hand_number,
796-
players: [0, 1].map((id) => ({
797-
id,
798-
name: agents[id].Name,
799-
thumbnail: agents[id].ThumbnailUrl,
800-
cards: stateForDeal.player_hands[id],
801-
chipStack: STARTING_STACK_SIZE - stateForDeal.player_contributions[id],
802-
currentBet: stateForDeal.player_contributions[id],
803-
currentBetForStreet: 0,
804-
reward: null,
805-
actionDisplayText: '',
806-
thoughts: '',
807-
isDealer: preDealStep.dealer === id,
808-
isTurn: false,
809-
isWinner: false,
810-
})),
801+
players: [0, 1].map((id) => {
802+
const chipStack = STARTING_STACK_SIZE - stateForDeal.player_contributions[id];
803+
804+
return {
805+
id,
806+
name: agents[id].Name,
807+
thumbnail: agents[id].ThumbnailUrl,
808+
cards: stateForDeal.player_hands[id],
809+
chipStack,
810+
currentBet: stateForDeal.player_contributions[id],
811+
currentBetForStreet: 0,
812+
reward: null,
813+
actionDisplayText: chipStack === 0 ? ALL_IN_STRING : '',
814+
thoughts: '',
815+
isDealer: preDealStep.dealer === id,
816+
isTurn: false,
817+
isWinner: false,
818+
}}),
811819
});
812820

813821
lastProcessedBoardLength = currentBoardLen;

0 commit comments

Comments
 (0)