kaggle-environments 1.17.7__py2.py3-none-any.whl → 1.17.8__py2.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/__init__.py +1 -1
- kaggle_environments/envs/open_spiel/games/chess/chess.js +35 -5
- {kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/METADATA +1 -1
- {kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/RECORD +8 -8
- {kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/WHEEL +1 -1
- {kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/entry_points.txt +0 -0
- {kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/licenses/LICENSE +0 -0
- {kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/top_level.txt +0 -0
kaggle_environments/__init__.py
CHANGED
|
@@ -158,6 +158,33 @@ function renderer(options) {
|
|
|
158
158
|
return true;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
// White is in position 1, Black is in position 0
|
|
162
|
+
function _getTeamNameForColor(color, teamNames) {
|
|
163
|
+
if (!teamNames || teamNames.length < 2) return null;
|
|
164
|
+
return color.toLowerCase() === 'white' ? teamNames[1] : teamNames[0];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function _deriveWinnerFromRewards(currentStepAgents, teamNames) {
|
|
168
|
+
if (!currentStepAgents || currentStepAgents.length < 2) return null;
|
|
169
|
+
|
|
170
|
+
const player0Reward = currentStepAgents[0].reward;
|
|
171
|
+
const player1Reward = currentStepAgents[1].reward;
|
|
172
|
+
|
|
173
|
+
if (player0Reward === player1Reward) {
|
|
174
|
+
return 'draw';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const winnerPlayerIndex = player0Reward === 1 ? 0 : 1;
|
|
178
|
+
const color = winnerPlayerIndex === 0 ? 'Black' : 'White';
|
|
179
|
+
|
|
180
|
+
if (teamNames) {
|
|
181
|
+
const teamName = _getTeamNameForColor(color, teamNames);
|
|
182
|
+
return `${color} (${teamName})`;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return color.toLowerCase();
|
|
186
|
+
}
|
|
187
|
+
|
|
161
188
|
function _parseFen(fen) {
|
|
162
189
|
if (!fen || typeof fen !== 'string') return null;
|
|
163
190
|
|
|
@@ -235,15 +262,17 @@ function renderer(options) {
|
|
|
235
262
|
if (String(winner).toLowerCase() === 'draw') {
|
|
236
263
|
currentWinnerTextElement.textContent = "It's a Draw!";
|
|
237
264
|
} else {
|
|
238
|
-
|
|
239
|
-
currentWinnerTextElement.innerHTML = `Winner: <span style="font-weight: bold;">${winnerColor}</span>`;
|
|
265
|
+
currentWinnerTextElement.innerHTML = `Winner: <span style="font-weight: bold;">${winner}</span>`;
|
|
240
266
|
}
|
|
241
267
|
} else {
|
|
242
268
|
currentWinnerTextElement.textContent = "Game ended.";
|
|
243
269
|
}
|
|
244
270
|
} else {
|
|
245
271
|
const playerColor = String(activeColor).toLowerCase() === 'w' ? 'White' : 'Black';
|
|
246
|
-
|
|
272
|
+
const teamName = _getTeamNameForColor(playerColor, environment.info?.TeamNames);
|
|
273
|
+
const currentPlayerText = teamName ? `${playerColor} (${teamName})` : playerColor;
|
|
274
|
+
|
|
275
|
+
currentStatusTextElement.innerHTML = `Current Player: <span style="font-weight: bold;">${currentPlayerText}</span>`;
|
|
247
276
|
}
|
|
248
277
|
}
|
|
249
278
|
|
|
@@ -285,11 +314,12 @@ function renderer(options) {
|
|
|
285
314
|
const fen = observationForRenderer.observationString;
|
|
286
315
|
const parsedFen = _parseFen(fen);
|
|
287
316
|
if (parsedFen) {
|
|
288
|
-
|
|
317
|
+
const winner = observationForRenderer.isTerminal ?
|
|
318
|
+
_deriveWinnerFromRewards(currentStepAgents, environment.info?.TeamNames) : null;
|
|
289
319
|
gameSpecificState = {
|
|
290
320
|
...parsedFen,
|
|
291
321
|
isTerminal: observationForRenderer.isTerminal,
|
|
292
|
-
winner:
|
|
322
|
+
winner: winner
|
|
293
323
|
};
|
|
294
324
|
}
|
|
295
325
|
} catch (e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
kaggle_environments/__init__.py,sha256=
|
|
1
|
+
kaggle_environments/__init__.py,sha256=_wgrdspX3nmKV-ySMVlvuqmo-d6UmFceru-fk2fFpVg,2175
|
|
2
2
|
kaggle_environments/agent.py,sha256=j9rLnCK_Gy0eRIuvlJ9vcMh3vxn-Wvu-pjCpannOolc,6703
|
|
3
3
|
kaggle_environments/api.py,sha256=eLBKqr11Ku4tdsMUdUqy74FIVEA_hdV3_QUpX84x3Z8,798
|
|
4
4
|
kaggle_environments/core.py,sha256=Ense_M-2rP4KmVeuKFjM0NQ8M6ucUZTbhwrGekyR9LY,27857
|
|
@@ -196,7 +196,7 @@ kaggle_environments/envs/open_spiel/proxy.py,sha256=8Shane4KWYKvbP9nV3l8VQfAFOfF
|
|
|
196
196
|
kaggle_environments/envs/open_spiel/proxy_test.py,sha256=QkmRo_uS0DgDDm2pbU2vwal5KOMCWKw92rC2_g3MziM,1837
|
|
197
197
|
kaggle_environments/envs/open_spiel/test_open_spiel.py,sha256=MwyjH-e00-3SP8_r10drYTFvplacbo0cDCI0XKtE4wU,3596
|
|
198
198
|
kaggle_environments/envs/open_spiel/games/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
199
|
-
kaggle_environments/envs/open_spiel/games/chess/chess.js,sha256=
|
|
199
|
+
kaggle_environments/envs/open_spiel/games/chess/chess.js,sha256=JYL3nDL_sayz3YPeMpsuE-waTZKkkuK4VRJN9lZYCKc,14045
|
|
200
200
|
kaggle_environments/envs/open_spiel/games/connect_four/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
201
201
|
kaggle_environments/envs/open_spiel/games/connect_four/connect_four.js,sha256=iO74ar3Hh64VYEx9v3eysgrPU-Mcokl9dkFxie6uISg,14893
|
|
202
202
|
kaggle_environments/envs/open_spiel/games/connect_four/connect_four_proxy.py,sha256=2otG99felDYhNhWpsadbM9YUaHtrXqhV1GFNEHhuPwA,2348
|
|
@@ -224,9 +224,9 @@ kaggle_environments/envs/tictactoe/tictactoe.js,sha256=NZDT-oSG0a6a-rso9Ldh9qkJw
|
|
|
224
224
|
kaggle_environments/envs/tictactoe/tictactoe.json,sha256=zMXZ8-fpT7FBhzz2FFBvRLn4XwtngjEqOieMvI6cCj8,1121
|
|
225
225
|
kaggle_environments/envs/tictactoe/tictactoe.py,sha256=uq3sTHWNMg0dxX2v9pTbJAKM7fwerxQt7OQjCX96m-Y,3657
|
|
226
226
|
kaggle_environments/static/player.html,sha256=TTxN-EU7_KCNIVDX4E4TrZ61FRWkGUDHMSbnUYsQSvg,24975
|
|
227
|
-
kaggle_environments-1.17.
|
|
228
|
-
kaggle_environments-1.17.
|
|
229
|
-
kaggle_environments-1.17.
|
|
230
|
-
kaggle_environments-1.17.
|
|
231
|
-
kaggle_environments-1.17.
|
|
232
|
-
kaggle_environments-1.17.
|
|
227
|
+
kaggle_environments-1.17.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
228
|
+
kaggle_environments-1.17.8.dist-info/METADATA,sha256=pP8vJJsca01VGe2qDDRjfGgcOpb4VQVchXzX7qyO8AM,10955
|
|
229
|
+
kaggle_environments-1.17.8.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
230
|
+
kaggle_environments-1.17.8.dist-info/entry_points.txt,sha256=HbVC-LKGQFV6lEEYBYyDTtrkHgdHJUWQ8_qt9KHGqz4,70
|
|
231
|
+
kaggle_environments-1.17.8.dist-info/top_level.txt,sha256=v3MMWIPMQFcI-WuF_dJngHWe9Bb2yH_6p4wat1x4gAc,20
|
|
232
|
+
kaggle_environments-1.17.8.dist-info/RECORD,,
|
{kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{kaggle_environments-1.17.7.dist-info → kaggle_environments-1.17.8.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|