Mappa: filtrando, i posti trovati si vedono (la mappa non resta lunga e scorsa in fondo); il Barone e le sue due donne e due jack; prove nel browser su una porta libera (con la 8080 giravano sul container)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ks2K99uqCZjAxvy7Rdj1R
This commit is contained in:
@@ -16,3 +16,16 @@ export function settle(game, { maxSteps = 20000 } = {}) {
|
||||
export function memoryStorage() {
|
||||
return { data: {}, getItem(k) { return this.data[k] ?? null; }, setItem(k, v) { this.data[k] = String(v); }, removeItem(k) { delete this.data[k]; } };
|
||||
}
|
||||
|
||||
// Il server statico delle prove nel browser, su una porta libera scelta dal sistema: con una porta a caso poteva
|
||||
// capitare la 8080 del gioco in Docker (make up), e la prova girava sul codice vecchio del container.
|
||||
export async function staticServer() {
|
||||
const { spawn } = await import('node:child_process');
|
||||
const server = spawn('python3', ['-u', '-m', 'http.server', '0', '--bind', '127.0.0.1'], { stdio: ['ignore', 'pipe', 'ignore'] });
|
||||
const port = await new Promise((resolve, reject) => {
|
||||
let out = '';
|
||||
server.stdout.on('data', d => { out += d; const m = out.match(/port (\d+)/); if (m) resolve(Number(m[1])); });
|
||||
server.on('exit', () => reject(new Error('il server di prova non è partito')));
|
||||
});
|
||||
return { port, kill: () => server.kill() };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user