kaggle-environments 1.23.4__py3-none-any.whl → 1.23.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kaggle-environments might be problematic. Click here for more details.
- kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/components/getRepeatedPokerStateForStep.js +39 -65
- kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.js +17 -11
- {kaggle_environments-1.23.4.dist-info → kaggle_environments-1.23.5.dist-info}/METADATA +1 -1
- {kaggle_environments-1.23.4.dist-info → kaggle_environments-1.23.5.dist-info}/RECORD +7 -7
- {kaggle_environments-1.23.4.dist-info → kaggle_environments-1.23.5.dist-info}/WHEEL +0 -0
- {kaggle_environments-1.23.4.dist-info → kaggle_environments-1.23.5.dist-info}/entry_points.txt +0 -0
- {kaggle_environments-1.23.4.dist-info → kaggle_environments-1.23.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
const allMoves = [];
|
|
1
|
+
function _getActionStringsFromACPC(bettingString, currentPlayer) {
|
|
2
|
+
const moves = [];
|
|
4
3
|
|
|
5
4
|
// Split the action string by street (e.g., ["r5c", "cr11f"])
|
|
6
5
|
const streets = bettingString.split('/');
|
|
@@ -10,60 +9,33 @@ function _getLastMovesACPC(bettingString, currentPlayer) {
|
|
|
10
9
|
const streetAction = streets[streetIndex];
|
|
11
10
|
let i = 0;
|
|
12
11
|
|
|
13
|
-
// Preflop (streetIndex 0), action is "open" due to blinds.
|
|
14
|
-
// Postflop (streetIndex > 0), action is "not open" (first player checks or bets).
|
|
15
|
-
let isAggressiveActionOpen = (streetIndex === 0);
|
|
16
|
-
|
|
17
12
|
// 4. Parse the moves within the street
|
|
18
13
|
while (i < streetAction.length) {
|
|
19
14
|
const char = streetAction[i];
|
|
20
|
-
let move = null;
|
|
21
15
|
|
|
22
|
-
if (char === '
|
|
23
|
-
// 'c' (call/check)
|
|
24
|
-
if (isAggressiveActionOpen) {
|
|
25
|
-
move = 'Call';
|
|
26
|
-
} else {
|
|
27
|
-
move = 'Check';
|
|
28
|
-
}
|
|
29
|
-
isAggressiveActionOpen = false; // 'c' never leaves action open
|
|
30
|
-
i++;
|
|
31
|
-
} else if (char === 'f') {
|
|
32
|
-
// 'f' (fold)
|
|
33
|
-
move = 'Fold';
|
|
34
|
-
isAggressiveActionOpen = false; // 'f' ends the hand
|
|
35
|
-
i++;
|
|
36
|
-
} else if (char === 'r') {
|
|
37
|
-
// 'r' (raise/bet)
|
|
16
|
+
if (char === 'r') {
|
|
38
17
|
let amount = '';
|
|
39
18
|
i++;
|
|
40
|
-
//
|
|
19
|
+
// parse all digits of the raise amount
|
|
41
20
|
while (i < streetAction.length && streetAction[i] >= '0' && streetAction[i] <= '9') {
|
|
42
21
|
amount += streetAction[i];
|
|
43
22
|
i++;
|
|
44
23
|
}
|
|
45
|
-
|
|
46
|
-
isAggressiveActionOpen = true; // 'r' always leaves action open
|
|
24
|
+
moves.push(`r${amount}`)
|
|
47
25
|
} else {
|
|
48
|
-
|
|
26
|
+
moves.push(char);
|
|
49
27
|
i++;
|
|
50
28
|
continue;
|
|
51
29
|
}
|
|
52
|
-
|
|
53
|
-
// 5. Store this move in the history
|
|
54
|
-
if (move) {
|
|
55
|
-
allMoves.push(move);
|
|
56
|
-
}
|
|
57
30
|
}
|
|
58
31
|
}
|
|
59
32
|
|
|
60
33
|
// 6. Get the last two moves from our complete list
|
|
61
|
-
const lastMove =
|
|
62
|
-
const secondLastMove = allMoves.length > 1 ? allMoves[allMoves.length - 2] : null;
|
|
34
|
+
const lastMove = moves.length > 0 ? moves[moves.length - 1] : null;
|
|
63
35
|
|
|
64
|
-
const
|
|
36
|
+
const actionStrings = currentPlayer === 0 ? [lastMove, ''] : ['', lastMove];
|
|
65
37
|
|
|
66
|
-
return
|
|
38
|
+
return actionStrings;
|
|
67
39
|
}
|
|
68
40
|
|
|
69
41
|
function _parseStepHistoryData(universalPokerJSON) {
|
|
@@ -71,7 +43,7 @@ function _parseStepHistoryData(universalPokerJSON) {
|
|
|
71
43
|
cards: [],
|
|
72
44
|
communityCards: '',
|
|
73
45
|
bets: [],
|
|
74
|
-
|
|
46
|
+
playerActionStrings: ['', ''],
|
|
75
47
|
winOdds: [0, 0],
|
|
76
48
|
};
|
|
77
49
|
|
|
@@ -135,7 +107,7 @@ function _parseStepHistoryData(universalPokerJSON) {
|
|
|
135
107
|
const bettingString = stateParts.slice(2, stateParts.length - 1).join(':');
|
|
136
108
|
|
|
137
109
|
if (bettingString) {
|
|
138
|
-
result.
|
|
110
|
+
result.playerActionStrings = _getActionStringsFromACPC(bettingString);
|
|
139
111
|
}
|
|
140
112
|
}
|
|
141
113
|
|
|
@@ -147,18 +119,6 @@ function _parseStepHistoryData(universalPokerJSON) {
|
|
|
147
119
|
return result;
|
|
148
120
|
}
|
|
149
121
|
|
|
150
|
-
|
|
151
|
-
function _getCurrentUniversalPokerFromStateHistory(stateHistory, step) {
|
|
152
|
-
if (stateHistory) {
|
|
153
|
-
|
|
154
|
-
const agentSteps = stateHistory.filter(s => JSON.parse(JSON.parse(s).current_universal_poker_json).current_player !== -1);
|
|
155
|
-
const currentStep = agentSteps[step];
|
|
156
|
-
return JSON.parse(JSON.parse(currentStep).current_universal_poker_json);
|
|
157
|
-
}
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
122
|
export const getPokerStateForStep = (environment, step) => {
|
|
163
123
|
const numPlayers = 2;
|
|
164
124
|
// --- Step Validation ---
|
|
@@ -167,6 +127,8 @@ export const getPokerStateForStep = (environment, step) => {
|
|
|
167
127
|
return null;
|
|
168
128
|
}
|
|
169
129
|
|
|
130
|
+
const stepsWithEndStates = environment.steps;
|
|
131
|
+
|
|
170
132
|
// --- Default State ---
|
|
171
133
|
const stateUIData = {
|
|
172
134
|
players: Array(numPlayers).fill(null).map((_, i) => {
|
|
@@ -182,33 +144,32 @@ export const getPokerStateForStep = (environment, step) => {
|
|
|
182
144
|
currentBet: 0,
|
|
183
145
|
isDealer: i === 0,
|
|
184
146
|
isTurn: false,
|
|
185
|
-
reward: null
|
|
147
|
+
reward: null,
|
|
148
|
+
actionDisplayText: ""
|
|
186
149
|
};
|
|
187
150
|
}),
|
|
188
151
|
communityCards: [],
|
|
189
152
|
pot: 0,
|
|
190
153
|
isTerminal: false,
|
|
191
|
-
blinds: [1, 2],
|
|
192
|
-
lastMoves: [],
|
|
193
154
|
rawObservation: null, // For debugging
|
|
194
155
|
step: step,
|
|
195
156
|
winOdds: [],
|
|
196
157
|
fiveCardBestHands: [],
|
|
197
|
-
currentPlayer: -1
|
|
158
|
+
currentPlayer: -1,
|
|
159
|
+
winner: -1,
|
|
198
160
|
};
|
|
199
161
|
|
|
200
162
|
// We have two sources for current game state: stepHistory and steps
|
|
201
163
|
// This is because neither source contains all the information we need
|
|
164
|
+
const currentStepData = stepsWithEndStates[step > 2 ? step - 2 : 0]; // Skip over setup steps
|
|
202
165
|
|
|
203
|
-
const
|
|
204
|
-
const p1stateFromSteps = environment.steps[step][1];
|
|
166
|
+
const currentPlayer = currentStepData?.step?.observation?.currentPlayer || 0; // TODO: find better way to get current player
|
|
205
167
|
|
|
206
|
-
const
|
|
207
|
-
const
|
|
168
|
+
const currentStateHistoryEntry = JSON.parse(currentStepData.stateHistory);
|
|
169
|
+
const currentUniversalPokerJSON = JSON.parse(currentStateHistoryEntry.current_universal_poker_json);
|
|
208
170
|
|
|
209
171
|
// TODO: Handle the flop phase steps (chance steps)
|
|
210
172
|
|
|
211
|
-
const currentUniversalPokerJSON = _getCurrentUniversalPokerFromStateHistory(environment.info.stateHistory, step);
|
|
212
173
|
const currentStepFromStateHistory = _parseStepHistoryData(currentUniversalPokerJSON);
|
|
213
174
|
|
|
214
175
|
const currentStepAgents = environment.steps[step];
|
|
@@ -233,8 +194,6 @@ export const getPokerStateForStep = (environment, step) => {
|
|
|
233
194
|
stateUIData.isTerminal = isTerminal;
|
|
234
195
|
stateUIData.pot = pot_size || 0;
|
|
235
196
|
stateUIData.communityCards = board_cards || [];
|
|
236
|
-
stateUIData.lastMoves = currentStepFromStateHistory.lastMoves;
|
|
237
|
-
stateUIData.blinds = currentStateFromStateHistory.blinds;
|
|
238
197
|
|
|
239
198
|
// --- Update Players ---
|
|
240
199
|
for (let i = 0; i < numPlayers; i++) {
|
|
@@ -245,8 +204,23 @@ export const getPokerStateForStep = (environment, step) => {
|
|
|
245
204
|
pData.currentBet = contribution;
|
|
246
205
|
pData.stack = startStack - contribution;
|
|
247
206
|
pData.cards = (player_hands[i] || []).map(c => c === "??" ? null : c);
|
|
248
|
-
pData.isTurn =
|
|
249
|
-
pData.isDealer =
|
|
207
|
+
pData.isTurn = currentPlayer === i; // TODO: this may need to be flipped to show the other player responding to this move, which will display instantly
|
|
208
|
+
pData.isDealer = currentStateHistoryEntry.dealer === i;
|
|
209
|
+
pData.actionDisplayText = currentStepFromStateHistory.playerActionStrings[i];
|
|
210
|
+
|
|
211
|
+
if (currentStepData.isEndState) {
|
|
212
|
+
pData.isTurn = false;
|
|
213
|
+
pData.isWinner = currentStepData.winner === i;
|
|
214
|
+
if (currentStepData.winner === i) {
|
|
215
|
+
pData.actionDisplayText = "WINNER"
|
|
216
|
+
} else {
|
|
217
|
+
if (currentStepData.handConclusion === "fold") {
|
|
218
|
+
pData.actionDisplayText = "FOLD"
|
|
219
|
+
} else {
|
|
220
|
+
pData.actionDisplayText = "LOSER"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
250
224
|
|
|
251
225
|
if (isTerminal) {
|
|
252
226
|
const reward = environment.rewards ? environment.rewards[i] : null;
|
|
@@ -264,4 +238,4 @@ export const getPokerStateForStep = (environment, step) => {
|
|
|
264
238
|
}
|
|
265
239
|
|
|
266
240
|
return stateUIData;
|
|
267
|
-
}
|
|
241
|
+
}
|
|
@@ -151,6 +151,10 @@ export function renderer(options) {
|
|
|
151
151
|
border-color: #20BEFF;
|
|
152
152
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(32, 190, 255, 0.5);
|
|
153
153
|
}
|
|
154
|
+
.player-info-area.winner-player {
|
|
155
|
+
border-color: #FFEB70;
|
|
156
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 235, 112, 0.6);
|
|
157
|
+
}
|
|
154
158
|
.player-container-0 .player-info-area { flex-direction: column-reverse; }
|
|
155
159
|
.player-name-wrapper {
|
|
156
160
|
display: flex;
|
|
@@ -226,6 +230,7 @@ export function renderer(options) {
|
|
|
226
230
|
text-align: center;
|
|
227
231
|
height: 20pxrem; line-height: 20px;
|
|
228
232
|
width: 150px;
|
|
233
|
+
height: 20px;
|
|
229
234
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
230
235
|
}
|
|
231
236
|
.blind-indicator { font-size: 0.7rem; color: #a0aec0; margin-top: 3px; }
|
|
@@ -560,7 +565,7 @@ export function renderer(options) {
|
|
|
560
565
|
|
|
561
566
|
// Update step counter
|
|
562
567
|
if (elements.stepCounter && step !== undefined) {
|
|
563
|
-
elements.stepCounter.textContent = `Step: ${step}`;
|
|
568
|
+
elements.stepCounter.textContent = `Debug Step: ${step}`;
|
|
564
569
|
}
|
|
565
570
|
|
|
566
571
|
if (elements.diagnosticHeader && data.rawObservation) {
|
|
@@ -596,9 +601,7 @@ export function renderer(options) {
|
|
|
596
601
|
players.forEach((playerData, index) => {
|
|
597
602
|
const playerNameElement = elements.playerNames[index];
|
|
598
603
|
if (playerNameElement) {
|
|
599
|
-
|
|
600
|
-
!playerData.isTurn && !isTerminal ? `${playerData.name} responding...` : playerData.name;
|
|
601
|
-
playerNameElement.textContent = playerNameText;
|
|
604
|
+
playerNameElement.textContent = playerData.name;
|
|
602
605
|
|
|
603
606
|
// Highlight current player's turn
|
|
604
607
|
if (playerData.isTurn && !isTerminal) {
|
|
@@ -653,18 +656,21 @@ export function renderer(options) {
|
|
|
653
656
|
playerInfoArea.classList.remove('active-player');
|
|
654
657
|
}
|
|
655
658
|
|
|
659
|
+
// Highlight winner's pod
|
|
660
|
+
if (playerData.isWinner) {
|
|
661
|
+
playerInfoArea.classList.add('winner-player');
|
|
662
|
+
} else {
|
|
663
|
+
playerInfoArea.classList.remove('winner-player');
|
|
664
|
+
}
|
|
665
|
+
|
|
656
666
|
playerInfoArea.querySelector('.player-stack-value').textContent = `${playerData.stack}`;
|
|
657
667
|
|
|
658
668
|
const betDisplay = playerInfoArea.querySelector('.bet-display');
|
|
659
669
|
if (playerData.currentBet > 0) {
|
|
660
|
-
if (
|
|
661
|
-
betDisplay.textContent =
|
|
670
|
+
if (playerData.actionDisplayText) {
|
|
671
|
+
betDisplay.textContent = playerData.actionDisplayText;
|
|
662
672
|
} else {
|
|
663
|
-
|
|
664
|
-
betDisplay.textContent = 'Small Blind';
|
|
665
|
-
} else {
|
|
666
|
-
betDisplay.textContent = 'Big Blind';
|
|
667
|
-
}
|
|
673
|
+
betDisplay.textContent = '';
|
|
668
674
|
}
|
|
669
675
|
betDisplay.style.display = 'block';
|
|
670
676
|
} else {
|
|
@@ -195,8 +195,8 @@ kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/
|
|
|
195
195
|
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/vite.config.ts,sha256=KhIjUn0WWhaoQzQ5YKuWjNndimRF0kFlYDgEnZ0cg7U,208
|
|
196
196
|
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/replays/test-replay.json,sha256=jf4ilR6SmOYPNohkIGJvmKP5Gju5FY6sfSStX1qtFZg,28919900
|
|
197
197
|
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/main.ts,sha256=5NZlic4P9aSdMJpWxckaDrObEx2OJj8FNG49g-Z9_ow,1095
|
|
198
|
-
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.js,sha256=
|
|
199
|
-
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/components/getRepeatedPokerStateForStep.js,sha256=
|
|
198
|
+
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.js,sha256=RmbMsVoJobYNypSiyv1kdG-hleRR5-jquIZJZZdVcyM,26598
|
|
199
|
+
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/components/getRepeatedPokerStateForStep.js,sha256=T-2pegCVHT1OP6PhllPS-3RRQYWe912v2dw5eR5tb0k,8051
|
|
200
200
|
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/components/utils.js,sha256=pXDAu4V2OppRCvMdJKQ56q1uFTJReMPIvBL6gwxIJoI,5734
|
|
201
201
|
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/images/poker_chip_1.svg,sha256=v9yCvpnaQAg8OSUJdJ5PhuTHm9_zXnww-9_7oR_DJpc,22160
|
|
202
202
|
kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/images/poker_chip_10.svg,sha256=z3CP2h5eUGlgBdqNoWGcioekAyPgiuzhyRNr-nbutOE,22160
|
|
@@ -279,8 +279,8 @@ kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_p
|
|
|
279
279
|
kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_parallel_voting_no_tie_exile.yaml,sha256=sfSFlFU4F7doZ-wXUWBl-JgJtmpjrLR-SpCAqKnUYeQ,3662
|
|
280
280
|
kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_parallel_voting_roundbiddiscussion.yaml,sha256=UGSLfOhmC-4pRqWsJvOtZRU0YLUuOMAGeEHtxTf3wf8,3710
|
|
281
281
|
kaggle_environments/static/player.html,sha256=Icl5yYscPe4BRoWt0HLOSRJWnznQq2MdTHHCaC2OrQQ,27753
|
|
282
|
-
kaggle_environments-1.23.
|
|
283
|
-
kaggle_environments-1.23.
|
|
284
|
-
kaggle_environments-1.23.
|
|
285
|
-
kaggle_environments-1.23.
|
|
286
|
-
kaggle_environments-1.23.
|
|
282
|
+
kaggle_environments-1.23.5.dist-info/entry_points.txt,sha256=h03sq76TdcHvXKcsre1Qm3lIni9dkWehu61xJqI-p8k,69
|
|
283
|
+
kaggle_environments-1.23.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
284
|
+
kaggle_environments-1.23.5.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
285
|
+
kaggle_environments-1.23.5.dist-info/METADATA,sha256=fO4oOApn4Mfm40bqXjJHUdnUYh9nqeKvB6ju2FHGLIc,916
|
|
286
|
+
kaggle_environments-1.23.5.dist-info/RECORD,,
|
|
File without changes
|
{kaggle_environments-1.23.4.dist-info → kaggle_environments-1.23.5.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{kaggle_environments-1.23.4.dist-info → kaggle_environments-1.23.5.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|