kaggle-environments 1.17.8__py2.py3-none-any.whl → 1.17.9__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.

@@ -20,7 +20,7 @@ from .core import *
20
20
  from .main import http_request
21
21
  from . import errors
22
22
 
23
- __version__ = "1.17.8"
23
+ __version__ = "1.17.9"
24
24
 
25
25
  __all__ = ["Agent", "environments", "errors", "evaluate", "http_request",
26
26
  "make", "register", "utils", "__version__",
@@ -1,5 +1,5 @@
1
1
  function renderer(options) {
2
- const { environment, step, parent, width = 400, height = 400 } = options;
2
+ const { environment, step, parent } = options;
3
3
 
4
4
  // Chess-specific constants
5
5
  const DEFAULT_NUM_ROWS = 8;
@@ -90,7 +90,7 @@ function renderer(options) {
90
90
  }
91
91
  parentElementToClear.appendChild(currentRendererContainer);
92
92
 
93
- const smallestParentEdge = Math.min(width, height);
93
+ const smallestParentEdge = Math.min(currentRendererContainer.offsetWidth, currentRendererContainer.offsetHeight);
94
94
  squareSize = Math.floor(smallestParentEdge / DEFAULT_NUM_COLS);
95
95
  currentBoardElement = document.createElement('div');
96
96
  Object.assign(currentBoardElement.style, {
@@ -158,33 +158,6 @@ 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
-
188
161
  function _parseFen(fen) {
189
162
  if (!fen || typeof fen !== 'string') return null;
190
163
 
@@ -262,17 +235,15 @@ function renderer(options) {
262
235
  if (String(winner).toLowerCase() === 'draw') {
263
236
  currentWinnerTextElement.textContent = "It's a Draw!";
264
237
  } else {
265
- currentWinnerTextElement.innerHTML = `Winner: <span style="font-weight: bold;">${winner}</span>`;
238
+ const winnerColor = String(winner).toLowerCase() === 'white' ? 'White' : 'Black';
239
+ currentWinnerTextElement.innerHTML = `Winner: <span style="font-weight: bold;">${winnerColor}</span>`;
266
240
  }
267
241
  } else {
268
242
  currentWinnerTextElement.textContent = "Game ended.";
269
243
  }
270
244
  } else {
271
245
  const playerColor = String(activeColor).toLowerCase() === 'w' ? 'White' : 'Black';
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>`;
246
+ currentStatusTextElement.innerHTML = `Current Player: <span style="font-weight: bold;">${playerColor}</span>`;
276
247
  }
277
248
  }
278
249
 
@@ -314,12 +285,11 @@ function renderer(options) {
314
285
  const fen = observationForRenderer.observationString;
315
286
  const parsedFen = _parseFen(fen);
316
287
  if (parsedFen) {
317
- const winner = observationForRenderer.isTerminal ?
318
- _deriveWinnerFromRewards(currentStepAgents, environment.info?.TeamNames) : null;
288
+ // Assuming `isTerminal` and `winner` are provided in the top-level observation
319
289
  gameSpecificState = {
320
290
  ...parsedFen,
321
291
  isTerminal: observationForRenderer.isTerminal,
322
- winner: winner
292
+ winner: observationForRenderer.winner
323
293
  };
324
294
  }
325
295
  } catch (e) {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kaggle-environments
3
- Version: 1.17.8
3
+ Version: 1.17.9
4
4
  Summary: Kaggle Environments
5
5
  Home-page: https://github.com/Kaggle/kaggle-environments
6
6
  Author: Kaggle
@@ -1,4 +1,4 @@
1
- kaggle_environments/__init__.py,sha256=_wgrdspX3nmKV-ySMVlvuqmo-d6UmFceru-fk2fFpVg,2175
1
+ kaggle_environments/__init__.py,sha256=8QsPJZNGNhDEtrXxvMEN4wlcphBUksoAC5kBxTNoUnE,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=JYL3nDL_sayz3YPeMpsuE-waTZKkkuK4VRJN9lZYCKc,14045
199
+ kaggle_environments/envs/open_spiel/games/chess/chess.js,sha256=cObFpGh4MG07UYbLWOosWvhclaFwAfnOPoyfm45xvrE,12966
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.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,,
227
+ kaggle_environments-1.17.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
228
+ kaggle_environments-1.17.9.dist-info/METADATA,sha256=WJv0FzLXP7eUEdZenlYdQyPdhSD2-UGKFhA73RAv8PU,10955
229
+ kaggle_environments-1.17.9.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
230
+ kaggle_environments-1.17.9.dist-info/entry_points.txt,sha256=HbVC-LKGQFV6lEEYBYyDTtrkHgdHJUWQ8_qt9KHGqz4,70
231
+ kaggle_environments-1.17.9.dist-info/top_level.txt,sha256=v3MMWIPMQFcI-WuF_dJngHWe9Bb2yH_6p4wat1x4gAc,20
232
+ kaggle_environments-1.17.9.dist-info/RECORD,,