origin-shift/origin-shift-export

<script src="./point_src/origin-shift/origin-shift-export"></script>

Written by Claude Opus 4.6 High - prompted by Jay.

Export the baked OriginShift maze to a plain JSON-friendly object. The result contains the grid metadata, node positions with connectivity, and a pre-computed edge list for consumers in other languages.

Usage:

let data = os.export()
let json = JSON.stringify(data)

The export captures the state after baking. A typical flow:

os.rebake(stage)
let data = os.export()

Or use the return value of rebake directly:

let data = os.rebake(stage)

Output shape:

{
    meta: { rows, cols, pointSpread, originIndex },
    nodes: [
        { index, row, col, x, y, target, color },
        ...
    ],
    edges: [ [fromIndex, toIndex], ... ]
}
  • nodes[i].target is the index of the node this cell points to (null for the origin).
  • edges lists every open passage as an undirected pair [a, b]. Two adjacent cells share an open passage when one points at the other.
Meta Data
filepath_exists True
path origin-shift/origin-shift-export
filepath origin-shift/origin-shift-export.js
clean_files ()