Skip to content

Keep wrap path heuristic on the torus when cells differ by more than the board - #5

Open
kvnloo wants to merge 1 commit into
xt4d:mainfrom
kvnloo:fix/wrap-heuristic-modulo
Open

Keep wrap path heuristic on the torus when cells differ by more than the board#5
kvnloo wants to merge 1 commit into
xt4d:mainfrom
kvnloo:fix/wrap-heuristic-modulo

Conversation

@kvnloo

@kvnloo kvnloo commented Sep 1, 2026

Copy link
Copy Markdown

wrapDelta used min(|d|, size-|d|) without reducing modulo size, so a pair of cells 10 apart on an 8-wide torus scored -2 and A* preferred garbage.

Reduce |d| % size first so the heuristic is the shorter torus arc and stays non-negative.

Pin: node --experimental-default-type=module --test gameblocks/modules/behavior/GridPathPlanner.test.js

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