Ask HN: How do you model temporarily invalid data structures
The article discusses the challenges of modeling temporarily invalid data structures in a chess game. It raises questions about whether to use an existing Board type while avoiding invalid states or to create a separate InvalidBoard type. The author seeks insights on how others have approached this issue in various contexts.
- ▪A valid chess board has one piece per square or none.
- ▪The author considers using a stack or data structure to manage invalid states.
- ▪There is a debate on whether to create a separate InvalidBoard type.
Hacker News (Newest) files mainly under programming. We currently carry 5,306 of its stories.
Story provenance
Source · retrieval · rights · ranking — open for full record
inspect →
Story provenance
Attribution is not the same as permission. This drawer separates discovery metadata, excerpts, WeSearch-generated summaries, reuse status, and whether the publisher receives the visit. Nothing here claims a legal grant the publisher has not made.
Record
| Original publisher | Ycombinator |
| Canonical URL | https://news.ycombinator.com/item?id=48285139 |
| Publication time | Tue, 26 May 2026 19:56:26 +0000 |
| Retrieval time | 2026-05-26T20:07:54.130Z |
| Last seen | 2026-05-26T20:07:57.647Z |
| Headline source | Publisher (no WeSearch rewrite) |
| Excerpt source | publisher body |
| Excerpt method | First ~120 words (~800 chars) of extracted publisher body, fair-use limited. |
| Summary | WeSearch · cerebras-chat (WeSearch summarizer) |
| Summary source text | contentText |
| Citation coverage | Summary is a WeSearch-generated derivative; primary citation is the original publisher URL. |
| Cluster | KA-2kNwkOIEd |
| Cluster logic | Grouped by semantic title/content similarity across sources within a rolling window. Same-publisher template collisions are excluded from coverage comparison. |
| Ranking reason | Story pages are not engagement-ranked. Hub feeds use recency, with optional source-diversified chronological ordering (cap consecutive stories per source). No personalized ranking. |
| Publisher visit | Yes — open original |
| Substitutes article? | No — link-out required for full text |
Rights status (four layers)
WeSearch handling by dimension
| Indexing | May the item be indexed (stored, ranked, made findable)? | Allowed |
| Snippet | May a short excerpt of the publisher's text be shown? | Allowed |
| AI summary | May WeSearch generate its own short summary of the article? | Limited |
| Retrieval / RAG | May the content be exposed for third-party retrieval-augmented generation? | Not asserted |
| Model training | May the content be used to train AI models? | Not asserted |
| Commercial reuse | May the content be reused commercially? | Not permitted |
Basis: Derived from the published RSS/Atom feed. Contact: [email protected]. Reviewed: 2026-07-24.
Opening excerpt (first ~120 words) tap to expand
Say you’re making a chess game. A valid board only has one piece per square, or zero. But, you have an algo that generates boards by moving pieces around and during that algo you may move a piece on top of another and then later decide to move one of them to get back to valid.Do you try to use some existing Board type and just avoid in your algo those invalid states (like by using a stack or some data structure to avoid iteratively moving pieces one at a time).Do you have a separate InvalidBoard type that allows multiple pieces per square?I think it’s context dependent but I’m curious how you’ve seen this handled in different ways.
Excerpt limited to ~120 words for fair-use compliance. The full article is at Ycombinator.