|
|
@ -40,8 +40,8 @@ describe("chase round generator", () => { |
|
|
"2,-1", |
|
|
"2,-1", |
|
|
"1,-2", |
|
|
"1,-2", |
|
|
], |
|
|
], |
|
|
"guardNodeId": "4,-5", |
|
|
"guardNodeId": "0,0", |
|
|
"guardStartNodeId": "4,-5", |
|
|
"guardStartNodeId": "0,0", |
|
|
"hasEscapePath": true, |
|
|
"hasEscapePath": true, |
|
|
"nodeCount": 20, |
|
|
"nodeCount": 20, |
|
|
"seed": 424242, |
|
|
"seed": 424242, |
|
|
@ -71,4 +71,23 @@ describe("chase round generator", () => { |
|
|
expect(pathLength).toBeGreaterThan(0); |
|
|
expect(pathLength).toBeGreaterThan(0); |
|
|
expect(pathLength).toBeLessThan(Infinity); |
|
|
expect(pathLength).toBeLessThan(Infinity); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("ensures thief and guard do not start on the same node", () => { |
|
|
|
|
|
const round = generateChaseRound({ seed: 123456, difficulty: "normal" }); |
|
|
|
|
|
expect(round.snapshot.thiefStartNodeId).not.toBe(round.snapshot.guardStartNodeId); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("stays playable and stable across many seeds", () => { |
|
|
|
|
|
for (let seed = 1; seed <= 60; seed += 1) { |
|
|
|
|
|
const round = generateChaseRound({ seed, difficulty: "normal" }); |
|
|
|
|
|
const nodeCount = Object.keys(round.snapshot.graph.nodes).length; |
|
|
|
|
|
|
|
|
|
|
|
expect(nodeCount).toBeGreaterThanOrEqual(20); |
|
|
|
|
|
expect(nodeCount).toBeLessThanOrEqual(30); |
|
|
|
|
|
expect(round.meta.hasEscapePath).toBe(true); |
|
|
|
|
|
expect(round.snapshot.thiefStartNodeId).not.toBe( |
|
|
|
|
|
round.snapshot.guardStartNodeId, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|