Skip to content

Commit 1a58b3a

Browse files
authored
Merge pull request #553 from Kaggle/go-refactor
Port open spiel go to new visualizer framework
2 parents 2ff331d + fcf277e commit 1a58b3a

File tree

7 files changed

+628
-0
lines changed

7 files changed

+628
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Go Visualizer</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@kaggle-environments/go-visualizer",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"dev-with-replay": "cross-env VITE_REPLAY_FILE=./replays/test-replay.json vite",
9+
"build": "tsc && vite build",
10+
"preview": "vite preview"
11+
},
12+
"devDependencies": {
13+
"cross-env": "^10.1.0",
14+
"typescript": "^5.0.0",
15+
"vite": "^5.0.0"
16+
},
17+
"dependencies": {
18+
"@kaggle-environments/core": "workspace:*",
19+
"htm": "^3.1.1",
20+
"preact": "^10.13.2"
21+
}
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { createReplayVisualizer, LegacyAdapter } from '@kaggle-environments/core';
2+
import { renderer } from './renderer.js';
3+
4+
const app = document.getElementById('app');
5+
if (!app) {
6+
throw new Error('Could not find app element');
7+
}
8+
9+
const adapter = new LegacyAdapter(renderer as any);
10+
if (app) {
11+
// Set up an HMR boundary for development
12+
if (import.meta.env?.DEV && import.meta.hot) {
13+
import.meta.hot.accept();
14+
}
15+
createReplayVisualizer(app, adapter);
16+
}

0 commit comments

Comments
 (0)