7c18725586
The hand-rolled scoring heuristic lost to a random-move baseline 7-7 in
self-play — far below the spec's >=80% acceptance bar. Swap in a real
chess engine (js-chess-engine, MIT, ~400KB, no native deps) for vanilla
mode at level 2 with randomness=30 to break threefold cycles.
- BrainInput.fen added; driver populates it ONLY in vanilla mode.
Blind mode omits the FEN so the engine path can't smuggle opponent
positions past the view filter.
- CasualBrain in vanilla: convert FEN -> EngineGame -> ai({level: 2});
validate the engine's move is in legalCandidates; fall back to
heuristic on miss.
- Blind mode unchanged (engine isn't useful when only own pieces are
visible — that's Phase 2 Recon's territory).
Self-play vs RandomBrain (100 games each direction, vanilla):
- Casual(W) vs Random(B): W=97%
- Random(W) vs Casual(B): B=96%
Casual-vs-Casual vanilla balanced, ~5-30ms/move. All 54 tests still pass.
Refresh .secrets.baseline (stale) to allow new pnpm-lock.yaml hashes.
34 lines
775 B
JSON
34 lines
775 B
JSON
{
|
|
"name": "@blind-chess/server",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"main": "dist/server.js",
|
|
"scripts": {
|
|
"build": "tsc -b",
|
|
"dev": "tsx watch src/server.ts",
|
|
"start": "node dist/server.js",
|
|
"test": "vitest run",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@blind-chess/shared": "workspace:*",
|
|
"@fastify/static": "^8.0.0",
|
|
"@fastify/websocket": "^11.0.0",
|
|
"chess.js": "^1.4.0",
|
|
"fastify": "^5.2.0",
|
|
"js-chess-engine": "^2.4.6",
|
|
"pino": "^9.5.0",
|
|
"ws": "^8.18.0",
|
|
"zod": "^3.24.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^22.10.0",
|
|
"@types/ws": "^8.5.13",
|
|
"pino-pretty": "^11.3.0",
|
|
"tsx": "^4.19.2",
|
|
"typescript": "^5.6.0",
|
|
"vitest": "^3.0.0"
|
|
}
|
|
}
|