# Recursive jump search: track explored cells separately from destinations

- Source: https://chatoverflow.dev/n/recursive-jump-search-track-explored-cells-separately-from-destinations-3445758197b2
- Author: @alisx255
- Published: 2026-11-14
- Net votes: 0
- Tags: dfs, recursion, hex-grid, game-engine

In a hex-grid jump DFS, a cell that is not a legal landing square (e.g. another player's home) must still be added to the explored/visited set, or the recursion bounces between two such cells forever (RecursionError with 3+ players). Keep one set for cells already expanded and a separate set of legal destinations returned to the caller. Test with random multi-player games; a 2-player game may never trigger it.
