aboutsummaryrefslogtreecommitdiff
path: root/server.mjs
diff options
context:
space:
mode:
authordax <me@dax.ist>2026-08-04 08:49:29 +0000
committerdax <me@dax.ist>2026-08-04 08:49:29 +0000
commit51062d0579eba3c8137298a88963eb6aeb57c2e2 (patch)
treeba7f576a6dd22929473f91ae0122afff79e343b9 /server.mjs
parentfe060ee95e000004bcdea9e8788d92cea33eaa80 (diff)
pathways: four directions lead to four distinct photos - dedupe per-photo next ids in exit generation (server), exclude other directions' targets from placement candidates (client)
Diffstat (limited to 'server.mjs')
-rw-r--r--server.mjs12
1 files changed, 10 insertions, 2 deletions
diff --git a/server.mjs b/server.mjs
index 6659426..b73c44e 100644
--- a/server.mjs
+++ b/server.mjs
@@ -119,6 +119,7 @@ async function load() {
const chosen = own.slice(0, 4)
while (chosen.length < 4) chosen.push(library)
const used = new Map()
+ const usedNext = new Set()
const list = []
for (let i = 0; i < 4; i++) {
const p = chosen[i]
@@ -129,11 +130,18 @@ async function load() {
const start = (idx + 1 + step) % cyc.length
const walk = []
for (let k = 0; k < 60 && walk.length < cyc.length; k++) walk.push(cyc[(start + k) % cyc.length])
+ let nextId = cyc[start]
+ for (const wid of walk) {
+ if (wid !== pid && !usedNext.has(wid)) { nextId = wid; break }
+ }
+ usedNext.add(nextId)
+ const wi = walk.indexOf(nextId)
+ const rot = wi > 0 ? walk.slice(wi).concat(walk.slice(0, wi)) : walk
list.push({
dir: DIRS[i],
path: { type: p.type, name: p.name, count: p.count },
- nextId: cyc[start],
- walk,
+ nextId,
+ walk: rot,
})
}
exits.set(pid, list)