Skip to content

v0.7.2 — nfty counts spaces it used to give up on

Choose a tag to compare

@corderro-artz corderro-artz released this 08 Sep 07:40
· 636 commits to main since this release

A book with 2,560,000 distinct assets used to report "more than 1000000" — a figure computable exactly in three multiplies. It now reports 2,560,000.

One limit was doing two jobs, and only one of them was expensive

UniqueSpace had a single cap of 1,000,000 bounding everything. Two of the things it bounded genuinely enumerate:

  • the per-selection walk a recipe with rules needs, one rules check at a time
  • the set of distinct colour buckets a colorization can reach

Both cost time and memory proportional to the number, so both need a budget. But everything else it bounded is arithmetic — with no rules the space factorizes, and the answer is a couple of multiplies. Capping that bought nothing and threw away the answer.

DefaultEnumerationBudget (1,000,000) bounds the walking. DefaultReportingCeiling bounds the arithmetic. IsExact now means exactly one thing: no enumeration gave up — which is what every caller already read it as.

What it cost in practice

Every layer added to the built-in demo meant re-tuning its quantize steps to keep a pure multiplication under a ceiling that was defending nothing — and since the demo asserts its own count is exact, that was a build failure rather than a cosmetic one. Adding the Feet layer in 0.7.0 paid that tax. It is gone; the next layer is free.

Two overflow holes the old cap was hiding by accident

Raising the ceiling exposed that both accumulation sites used add-then-clamp, which is only safe while the clamp sits far below the range of the type. At a million they could never overflow; at the new ceiling they silently would, turning a very large space into a negative one. UniqueSpace.Add saturates now, and so does the per-recipe sum in the generator's failure message — "allows exactly -3 unique DNA" is a worse message than any true one.

Also

  • UniqueSpaceCount.Cap is now Budget, naming the limit somebody would actually raise.
  • Removed LegalCombinations and CountColorBuckets — private, zero callers since an earlier refactor. Unused private methods raise an analyzer suggestion rather than a warning, so they survived a zero-warning build.

Downloads

framework-dependent smallest; needs the .NET 10 runtime
single-file-net10 one .exe; needs the .NET 10 runtime
single-file one .exe, nothing to install
portable unzip and run, nothing to install

Manual: https://www.vaporsoft.dev/nfty