Skip to content

Fix seed: 0 being ignored in dungeon generation#50

Merged
LucianBuzzo merged 1 commit intomasterfrom
lucianbuzzo/fix-seed-zero-handling
Feb 24, 2026
Merged

Fix seed: 0 being ignored in dungeon generation#50
LucianBuzzo merged 1 commit intomasterfrom
lucianbuzzo/fix-seed-zero-handling

Conversation

@LucianBuzzo
Copy link
Owner

@LucianBuzzo LucianBuzzo commented Feb 24, 2026

Summary

build() currently derives the seed with stage.seed || randomSeed, which treats 0 as absent and replaces it with a random value.

This PR:

  • switches seed fallback logic to only generate a random seed when seed is null or undefined
  • keeps explicit falsy seeds (like 0) intact
  • adds a regression test proving deterministic output for seed: 0

Why

Numeric seeds are part of the public API (string | number). 0 should be a valid deterministic seed, not silently replaced.

Validation

  • npm test --silent (50 tests passed)

@LucianBuzzo LucianBuzzo changed the title Fix being ignored in dungeon generation Fix seed: 0 being ignored in dungeon generation Feb 24, 2026
@LucianBuzzo LucianBuzzo merged commit 6d0136f into master Feb 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant