// Excerpt: dependent updates omitted
var ready = new SortedSet<int>(
Specs.Where(s => incoming[s.Id] == 0)
.Select(s => SpecIndex[s.Id]));
while (ready.Count > 0) {
var id = Specs[ready.Min].Id;
ready.Remove(ready.Min); order.Add(id);
// Update and enqueue dependent nodes.
}
return order.Count == Specs.Count ? order
: throw new InvalidOperationException(
"Dependency cycle survived cycle removal.");
Inspect the complete algorithm
Abbreviated source excerpt. Declaration-index tie breaks keep ordering deterministic; the full linked method updates dependent nodes.
TomeStack
A Windows tabletop character builder where each derived value can show the rule, source page, and character choice behind it. Offline-first, with a Windows installer linked under Releases.
Hard part: derived statistics (a character’s numbers) must stay understandable when imported and custom game effects interact. Decision: declarative effects, a dependency-ordered graph with cycle detection, and source-cited traces.
Solo build · .NET 10, React, SQLite · current release linked below
The test suites check calculated values and their source-cited traces; property tests cover formulas and serialization. CI includes Windows builds and a desktop smoke test.