kaggle-environments 1.15.0__py2.py3-none-any.whl → 1.15.2__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/chess/chess.js +75 -66
- {kaggle_environments-1.15.0.dist-info → kaggle_environments-1.15.2.dist-info}/METADATA +1 -1
- {kaggle_environments-1.15.0.dist-info → kaggle_environments-1.15.2.dist-info}/RECORD +8 -8
- {kaggle_environments-1.15.0.dist-info → kaggle_environments-1.15.2.dist-info}/LICENSE +0 -0
- {kaggle_environments-1.15.0.dist-info → kaggle_environments-1.15.2.dist-info}/WHEEL +0 -0
- {kaggle_environments-1.15.0.dist-info → kaggle_environments-1.15.2.dist-info}/entry_points.txt +0 -0
- {kaggle_environments-1.15.0.dist-info → kaggle_environments-1.15.2.dist-info}/top_level.txt +0 -0
kaggle_environments/__init__.py
CHANGED
|
@@ -1,73 +1,82 @@
|
|
|
1
1
|
async function renderer(context) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
const {
|
|
3
|
+
environment,
|
|
4
|
+
frame,
|
|
5
|
+
height = 400,
|
|
6
|
+
parent,
|
|
7
|
+
step,
|
|
8
|
+
width = 400,
|
|
9
|
+
} = context;
|
|
10
|
+
|
|
11
|
+
// Common Dimensions.
|
|
12
|
+
const canvasSize = Math.min(height, width);
|
|
13
|
+
const boardSize = canvasSize * 0.8;
|
|
14
|
+
const squareSize = boardSize / 8;
|
|
15
|
+
const offset = (canvasSize - boardSize) / 2;
|
|
16
|
+
|
|
17
|
+
// Canvas Setup.
|
|
18
|
+
let canvas = parent.querySelector("canvas");
|
|
19
|
+
if (!canvas) {
|
|
20
|
+
canvas = document.createElement("canvas");
|
|
21
|
+
parent.appendChild(canvas);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Canvas setup and reset.
|
|
25
|
+
let c = canvas.getContext("2d");
|
|
26
|
+
canvas.width = canvasSize;
|
|
27
|
+
canvas.height = canvasSize;
|
|
28
|
+
c.clearRect(0, 0, canvas.width, canvas.height);
|
|
29
|
+
// Draw the Chessboard
|
|
30
|
+
for (let row = 0; row < 8; row++) {
|
|
31
|
+
for (let col = 0; col < 8; col++) {
|
|
32
|
+
const x = col * squareSize + offset;
|
|
33
|
+
const y = row * squareSize + offset;
|
|
34
|
+
|
|
35
|
+
// Alternate colors for squares
|
|
36
|
+
c.fillStyle = (row + col) % 2 === 0 ? "#D18B47" : "#FFCE9E";
|
|
37
|
+
c.fillRect(x, y, squareSize, squareSize);
|
|
22
38
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (let
|
|
32
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Draw the Pieces
|
|
42
|
+
const board = environment.steps[step][0].observation.board;
|
|
43
|
+
const chess = new Chess(board);
|
|
44
|
+
const boardObj = chess.board();
|
|
45
|
+
|
|
46
|
+
for (let row = 0; row < 8; row++) {
|
|
47
|
+
for (let col = 0; col < 8; col++) {
|
|
48
|
+
const piece = boardObj[row][col];
|
|
49
|
+
if (piece) {
|
|
33
50
|
const x = col * squareSize + offset;
|
|
34
51
|
const y = row * squareSize + offset;
|
|
35
|
-
|
|
36
|
-
// Alternate colors for squares
|
|
37
|
-
c.fillStyle = (row + col) % 2 === 0 ? '#D18B47' : '#FFCE9E';
|
|
38
|
-
c.fillRect(x, y, squareSize, squareSize);
|
|
52
|
+
drawPiece(c, piece.type, piece.color, x, y, squareSize);
|
|
39
53
|
}
|
|
40
54
|
}
|
|
41
|
-
|
|
42
|
-
// Draw the Pieces
|
|
43
|
-
const board = environment.steps[step][0].observation.board;
|
|
44
|
-
const chess = new Chess(board);
|
|
45
|
-
const boardObj = chess.board();
|
|
46
|
-
|
|
47
|
-
for (let row = 0; row < 8; row++) {
|
|
48
|
-
for (let col = 0; col < 8; col++) {
|
|
49
|
-
const piece = boardObj[row][col]
|
|
50
|
-
if (piece) {
|
|
51
|
-
const x = col * squareSize + offset;
|
|
52
|
-
const y = row * squareSize + offset;
|
|
53
|
-
drawPiece(c, piece.type, piece.color, x, y, squareSize);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
55
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Helper function to draw individual pieces (replace with your own images/logic)
|
|
59
|
+
function drawPiece(c, type, color, x, y, size) {
|
|
60
|
+
const pieceCode = color === "w" ? type.toUpperCase() : type.toLowerCase();
|
|
61
|
+
// Unicode characters for chess pieces
|
|
62
|
+
const pieceSymbols = {
|
|
63
|
+
P: "♙",
|
|
64
|
+
R: "♖",
|
|
65
|
+
N: "♘",
|
|
66
|
+
B: "♗",
|
|
67
|
+
Q: "♕",
|
|
68
|
+
K: "♔",
|
|
69
|
+
p: "♟",
|
|
70
|
+
r: "♜",
|
|
71
|
+
n: "♞",
|
|
72
|
+
b: "♝",
|
|
73
|
+
q: "♛",
|
|
74
|
+
k: "♚",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
c.font = `${size * 0.8}px Arial`;
|
|
78
|
+
c.textAlign = "center";
|
|
79
|
+
c.textBaseline = "middle";
|
|
80
|
+
c.fillStyle = color === "w" ? "white" : "black";
|
|
81
|
+
c.fillText(pieceSymbols[pieceCode], x + size / 2, y + size / 2);
|
|
82
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
kaggle_environments/__init__.py,sha256=
|
|
1
|
+
kaggle_environments/__init__.py,sha256=arK_zFUETl695yMkL0w496EMup7J7tB-q6ESeaRA7D0,1682
|
|
2
2
|
kaggle_environments/agent.py,sha256=BpYrAC6EOhJF3Wzynq-CWg8l-z5uXW1Lq4qUsyOM0ik,6203
|
|
3
3
|
kaggle_environments/api.py,sha256=eLBKqr11Ku4tdsMUdUqy74FIVEA_hdV3_QUpX84x3Z8,798
|
|
4
4
|
kaggle_environments/core.py,sha256=IrEkN9cIA2djBAxI8Sz1GRpGNKjhqbnBdV6irAeTm8Q,27851
|
|
@@ -8,7 +8,7 @@ kaggle_environments/main.py,sha256=10wtcEFcGIjdOd9AEps5WOAwslc6Wsx3eZ43LXJa8jE,1
|
|
|
8
8
|
kaggle_environments/schemas.json,sha256=zGzLyhqPdH6QQ0d48SrP5LKbvupprrWvgfQBerLqmhw,3307
|
|
9
9
|
kaggle_environments/status_codes.json,sha256=6a8HuS_Vth95W0f2fov21QLdRfA3KbizUvjKmJhYtBc,995
|
|
10
10
|
kaggle_environments/utils.py,sha256=FcI17PA4QK2-hyNp0dryS0TQ2pFlH9K19zDUMmuF4-E,5713
|
|
11
|
-
kaggle_environments/envs/chess/chess.js,sha256=
|
|
11
|
+
kaggle_environments/envs/chess/chess.js,sha256=0FCtbp-Ph5wyHEWuqzbSy3mQJdGPCU4CL9fB-E1_2_A,2156
|
|
12
12
|
kaggle_environments/envs/chess/chess.json,sha256=fmyEm7slLKlykbj-Rm_x7wvHAoJXa_JePU1rjA8gwxo,1201
|
|
13
13
|
kaggle_environments/envs/chess/chess.py,sha256=0K42aiigMt0NSwzbMkCqzGf4zXFiuUzb_jaBsJq4r0M,3095
|
|
14
14
|
kaggle_environments/envs/chess/test_chess.py,sha256=L8C88clpAOiJcP9BVQjDlVtsBu_8eRw3YH5ShGScciQ,239
|
|
@@ -181,9 +181,9 @@ kaggle_environments/envs/tictactoe/tictactoe.js,sha256=NZDT-oSG0a6a-rso9Ldh9qkJw
|
|
|
181
181
|
kaggle_environments/envs/tictactoe/tictactoe.json,sha256=zMXZ8-fpT7FBhzz2FFBvRLn4XwtngjEqOieMvI6cCj8,1121
|
|
182
182
|
kaggle_environments/envs/tictactoe/tictactoe.py,sha256=iLNU5V-lz7Xab-d1vpPMfU5jDM3QtgBUH63Y_SU7I9Y,3639
|
|
183
183
|
kaggle_environments/static/player.html,sha256=XyVoe0XxMa2MO1fTDY_rjyjzPN-JZgbVwJIDoLSnlw0,23016
|
|
184
|
-
kaggle_environments-1.15.
|
|
185
|
-
kaggle_environments-1.15.
|
|
186
|
-
kaggle_environments-1.15.
|
|
187
|
-
kaggle_environments-1.15.
|
|
188
|
-
kaggle_environments-1.15.
|
|
189
|
-
kaggle_environments-1.15.
|
|
184
|
+
kaggle_environments-1.15.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
185
|
+
kaggle_environments-1.15.2.dist-info/METADATA,sha256=y2XgtZWun4QrzZiLe1KZu_Isf-EkHG2owit-av9_4gI,10697
|
|
186
|
+
kaggle_environments-1.15.2.dist-info/WHEEL,sha256=m9WAupmBd2JGDsXWQGJgMGXIWbQY3F5c2xBJbBhq0nY,110
|
|
187
|
+
kaggle_environments-1.15.2.dist-info/entry_points.txt,sha256=HbVC-LKGQFV6lEEYBYyDTtrkHgdHJUWQ8_qt9KHGqz4,70
|
|
188
|
+
kaggle_environments-1.15.2.dist-info/top_level.txt,sha256=v3MMWIPMQFcI-WuF_dJngHWe9Bb2yH_6p4wat1x4gAc,20
|
|
189
|
+
kaggle_environments-1.15.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{kaggle_environments-1.15.0.dist-info → kaggle_environments-1.15.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|