Niente strade a senso unico: il tennis della chiesa va e torna da Carza e ponticino; un test lo controlla

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017egeN2amL84ErjfgQFtEDn
This commit is contained in:
2026-10-24 00:30:59 +02:00
co-authored by Claude Opus 5.5
parent 76d88ab4a7
commit c2b542e3f0
2 changed files with 18 additions and 4 deletions
+7 -4
View File
@@ -639,9 +639,6 @@ export const story = {
{ {
id: 'al_piazzale', name: 'laggiù, il piazzale delle feste', box: [40, 100, 120, 70], at: [130, 224], exit: { scene: 'area_feste_festa', at: [320, 350], face: 'up' }, id: 'al_piazzale', name: 'laggiù, il piazzale delle feste', box: [40, 100, 120, 70], at: [130, 224], exit: { scene: 'area_feste_festa', at: [320, 350], face: 'up' },
}, },
{
id: 'alla_polisportiva', name: 'in fondo, verso il campo sportivo', box: [360, 168, 110, 34], at: [400, 198], exit: { scene: 'polisportiva_principale', at: [40, 330], face: 'right' },
},
{ {
id: 'alla_rotonda', name: 'indietro, verso la rotonda', box: [0, 330, 640, 30], at: [300, 354], exit: { scene: 'via_provinciale', at: [120, 345], face: 'up' }, id: 'alla_rotonda', name: 'indietro, verso la rotonda', box: [0, 330, 640, 30], at: [300, 354], exit: { scene: 'via_provinciale', at: [120, 345], face: 'up' },
}, },
@@ -874,6 +871,9 @@ export const story = {
talk: [{ say: 'Partita?' }, { say: '...' }, { say: 'Mi sa che vince lui ai punti. Non si muove mai.' }], talk: [{ say: 'Partita?' }, { say: '...' }, { say: 'Mi sa che vince lui ai punti. Non si muove mai.' }],
}, },
}, },
{
id: 'al_cancello', name: 'dal cancello verde, verso il posticino della Carza', box: [380, 300, 120, 60], at: [440, 330], exit: { scene: 'carza', at: [440, 290], face: 'left' },
},
{ {
id: 'alla_carza', name: 'verso il ponticino della Carza', box: [470, 140, 120, 130], at: [515, 280], exit: { scene: 'ponticino', at: [400, 350], face: 'up' }, id: 'alla_carza', name: 'verso il ponticino della Carza', box: [470, 140, 120, 130], at: [515, 280], exit: { scene: 'ponticino', at: [400, 350], face: 'up' },
}, },
@@ -1027,7 +1027,7 @@ export const story = {
}, },
}, },
{ {
id: 'cancello', name: 'cancello verde, verso il tennis della chiesa', box: [460, 150, 46, 132], at: [440, 290], face: 'right', exit: { scene: 'tennis_chiesa', at: [320, 350], face: 'up' }, id: 'cancello', name: 'cancello verde, verso il tennis della chiesa', box: [460, 150, 46, 132], at: [440, 290], face: 'right', exit: { scene: 'tennis_chiesa', at: [440, 330], face: 'up' },
actions: { actions: {
look: [{ say: 'Il cancello verde, sempre aperto. Di là c\'è il tennis della chiesa.' }], look: [{ say: 'Il cancello verde, sempre aperto. Di là c\'è il tennis della chiesa.' }],
}, },
@@ -1067,6 +1067,9 @@ export const story = {
{ {
id: 'alla_stazione', name: 'a destra, verso la stazione', box: [486, 160, 90, 40], at: [474, 202], exit: { scene: 'stazione', at: [20, 300], face: 'right' }, id: 'alla_stazione', name: 'a destra, verso la stazione', box: [486, 160, 90, 40], at: [474, 202], exit: { scene: 'stazione', at: [20, 300], face: 'right' },
}, },
{
id: 'al_tennis', name: 'giù, verso il tennis della chiesa', box: [0, 160, 230, 70], at: [300, 330], exit: { scene: 'tennis_chiesa', at: [515, 280], face: 'left' },
},
{ {
id: 'alla_carza', name: 'indietro, verso la Pieve', box: [0, 330, 640, 30], at: [400, 354], exit: { scene: 'carza', at: [325, 222], face: 'down' }, id: 'alla_carza', name: 'indietro, verso la Pieve', box: [0, 330, 640, 30], at: [400, 354], exit: { scene: 'carza', at: [325, 222], face: 'down' },
}, },
+11
View File
@@ -220,3 +220,14 @@ test('ogni oggetto ha la sua icona a pixel', () => {
assert.match(svg, /viewBox="0 0 16 16"/, `${id}: l'icona deve essere 16x16`); assert.match(svg, /viewBox="0 0 16 16"/, `${id}: l'icona deve essere 16x16`);
} }
}); });
test('le strade vanno e tornano: niente sensi unici, e ogni posto si raggiunge dalla partenza', () => {
const exits = {};
for (const [id, sc] of Object.entries(story.scenes))
for (const h of sc.hotspots ?? []) if (h.exit) (exits[id] ??= new Set()).add(h.exit.scene);
for (const [a, to] of Object.entries(exits))
for (const b of to) assert.ok(exits[b]?.has(a), `da ${a} si va a ${b}, ma da ${b} non si torna a ${a}`);
const seen = new Set([story.start.scene]), queue = [story.start.scene];
while (queue.length) for (const b of exits[queue.shift()] ?? []) if (!seen.has(b)) { seen.add(b); queue.push(b); }
for (const id of Object.keys(story.scenes)) assert.ok(seen.has(id), `${id} non si raggiunge`);
});