Skip to main content

reaches_origin

Function reaches_origin 

Source
pub fn reaches_origin(lot: TreeCoord) -> bool
Expand description

True iff lot admits a path of populated king-neighbors back to origin where every step strictly decreases manhattan distance. Origin itself returns true; unpopulated lots (gap roll) return false.

The strict-decrease constraint is what makes the procgen orphan-free: it’s impossible to form a cycle among lots if every edge in the chain reduces a non-negative integer (manhattan distance), so any successful chain terminates at origin in at most lot.manhattan() steps. Recursion depth is therefore bounded by manhattan distance, and the thread-local memo collapses overlapping sub-chains across the many lots the renderer asks about per frame.