Skip to content

moon-check.mjs

Bakes the fixed set of NAMED_MOONS twice and checks each moon's terrain, landmarks, and palette against the rules a moon must hold.

Contributor toolingmoon-check.mjs

What it does

Bakes each of the three NAMED_MOONS (sieve, bloom, hoar) twice through bakeMoon. Checks that a moon carries no water kind and at least one mountain hex. Checks that every volcano is extinct and stands on a mountain, and that there are no flow lines except rime's crevasses. Checks that there is no abyss output, that the palette stays under the saturation ceiling, and that a moon-fog op sits in the ambient layer. Also checks that the two bakes of one seed hash identically and match byte for byte in their terrain kinds.

Usage

No package.json script wraps this tool. Run it directly:

bash
node tools/moon-check.mjs

Options

No options.

Inputs and outputs

Takes no file input; every moon is baked in memory from the fixed seeds and configs in NAMED_MOONS, resolved through bakeMoon (src/engine/moon.mjs). Writes nothing to disk — every result prints to stdout (or stderr for failures).

On success, exit 0. Prints a per-moon report: kind counts, landmark count and density, volcano count and how many read active, flow line count, palette mean saturation, and the determinism check. Ends with a green summary line.

On failure, exit 1. Each violation is printed as its own FAIL line under the moon's report, and the run ends by naming every moon that failed.

Examples

After changing anything under src/engine/moon.mjs or src/engine/tile-landmarks.mjs, confirm the three named moons still hold:

bash
node tools/moon-check.mjs

Notes

Not part of npm run check. Run it directly after touching moon generation.

A moon's land fraction is fixed at 1.0, so any water-kind hex on a moon is a violation by itself. A moon with zero mountain hexes fails separately, since a volcano landmark has nowhere legal left to stand.

Source

tools/moon-check.mjs — part of Contributor tooling