diff options
| author | dax <me@dax.ist> | 2026-08-04 09:22:43 +0000 |
|---|---|---|
| committer | dax <me@dax.ist> | 2026-08-04 09:22:43 +0000 |
| commit | 31377791a19454e76cf3f4f74f1d90e3460f5c2d (patch) | |
| tree | 9b4cc2b7abce31933a5f3bdfc15ed954eb5053fa /server.mjs | |
| parent | 598d24645f5ffce7d4551d4d7def183f4cb14a7a (diff) | |
pathways: no dead-end directions while photos remain - server extends short walks with library ids to 60 entries, client falls back to any remaining unplaced photo when a direction's walk is exhausted
Diffstat (limited to 'server.mjs')
| -rw-r--r-- | server.mjs | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -137,11 +137,17 @@ async function load() { usedNext.add(nextId) const wi = walk.indexOf(nextId) const rot = wi > 0 ? walk.slice(wi).concat(walk.slice(0, wi)) : walk + const li = library.ids.indexOf(pid) + const ext = rot.slice() + for (let k = 1; ext.length < 60 && k < library.ids.length; k++) { + const wid = library.ids[(li + k) % library.ids.length] + if (wid !== pid && !ext.includes(wid)) ext.push(wid) + } list.push({ dir: DIRS[i], path: { type: p.type, name: p.name, count: p.count }, nextId, - walk: rot, + walk: ext, }) } exits.set(pid, list) |
