New ask Hacker News story: O(1) memory, no-preprocessing reachability algorithm for 2D grids
O(1) memory, no-preprocessing reachability algorithm for 2D grids 2 by MatthiasGibis | 0 comments on Hacker News. I’ve been working on a reachability checker for 2D grids that: - uses *O(1) memory* - requires *no preprocessing* - handles *arbitrary obstacle maps* - and finishes in under 0.1ms even on large grids (e.g. 16,000×16,000 from bottom-left to top-right) It works without BFS, DFS, A , or flood fill. The core idea is a hybrid of greedy movement toward the goal and robust outline-following (wall tracing) that switches direction when needed and detects loops to ensure correctness. The algorithm is fully deterministic and guarantees correctness for any map and any pair of walkable start/end points. My motivation: I want to make traditional flood fill obsolete for any project that uses it purely for reachability checks. In many real-time systems (like games), a full BFS/DFS or even region-preprocessing is overkill when you just need to answer: “Can I reach tile B from tile A?”* H...