diff --git a/viewer/.gitignore b/viewer/.gitignore index 3614cbb..a22e349 100644 --- a/viewer/.gitignore +++ b/viewer/.gitignore @@ -19,3 +19,5 @@ pnpm-debug.log* *.njsproj *.sln *.sw? + +.env \ No newline at end of file diff --git a/viewer/src/self-contained.ts b/viewer/src/self-contained.ts index e3a4dee..a0fd886 100644 --- a/viewer/src/self-contained.ts +++ b/viewer/src/self-contained.ts @@ -1,6 +1,7 @@ -import { move as execMove, Move, setup, stripSecret } from 'container-engine'; +import { GameState, move as execMove, Move, setup, stripSecret } from 'container-engine'; import { moveAI } from 'container-engine/src/engine'; import { cloneDeep } from 'lodash'; +import AbstractJudge from '../../engine/src/fixtures/Abstract-judge-7215.json'; import launch from './launch'; function launchSelfContained(selector = '#app') { @@ -14,12 +15,17 @@ function launchSelfContained(selector = '#app') { gameState.players[i].name = `Player ${i + 1}`; } - const playerIndex = 1; + let playerIndex = 1; for (const player of gameState.players) { if (player.id != playerIndex) player.isAI = true; } + if (process.env.VUE_APP_loadGame) { + gameState = AbstractJudge as GameState; + playerIndex = AbstractJudge.currentPlayers[0]; + } + emitter.on('move', async (move: Move) => { console.log('move received', move); gameState = execMove(gameState, move, playerIndex); diff --git a/viewer/tsconfig.json b/viewer/tsconfig.json index cdd674a..dac3e6e 100644 --- a/viewer/tsconfig.json +++ b/viewer/tsconfig.json @@ -11,6 +11,7 @@ "allowSyntheticDefaultImports": true, "noImplicitAny": false, "sourceMap": true, + "resolveJsonModule": true, "baseUrl": ".", "types": ["webpack-env", "mocha", "chai"], "paths": {