Roll and Race: Board Tracks, Spaces and Pawns Kit
README.md
boardKit.tracks
Procedural board tracks of any length (10 to 400 spaces). Tracks.generate(shape, n, opts) returns { shape, n, spaces, bounds, dist, fork?, grid? }, where each space is { i, x, y, z, yaw, next, prev, lane, row?, col? } in space units (neighbours about 1 apart), centred on the origin with +Z towards the front edge.
| shape | what it is |
|---|---|
loop | a rounded rectangle; the finish sits just behind the start |
snake | rows back and forth joined by round turns |
spiral | from the outside in; the finish is the centre |
figure8 | an eight whose second crossing passes over a bridge |
fork | the route splits into the long way and the short cut, then joins again |
climb | a numbered grid read back and forth, row by row, upwards (ladders and slides are placed by boardKit.spaces) |
Tracks.check(track) proves the track sound (ordered, linked both ways, every space between start and finish, no two closer than 0.8). Tracks.step(track, i, branch) walks one space. Tracks.resolve("figure eight") is forgiving about names.