Skip to content

Bound automatic diagonal heuristics by two cardinal steps - #198

Merged
HexDecimal merged 3 commits into
libtcod:mainfrom
antonsoo:fix/automatic-diagonal-heuristic
Oct 17, 2026
Merged

HexDecimal merged 3 commits into
libtcod:mainfrom
antonsoo:fix/automatic-diagonal-heuristic

Conversation

@antonsoo

Copy link
Copy Markdown
Contributor

SimpleGraph can overestimate the remaining cost when a diagonal costs more than two cardinal steps. On the regression's unit-cost map, cardinal cost 1 and diagonal cost 3 return a cost-9 path although eight cardinal steps suffice.

Cap the automatic diagonal estimate at two cardinal steps. Keep the actual diagonal edge cost, diagonal-only graphs, greed multiplier and explicit heuristic overrides.

The regressions cover C/F layouts and diagonal-only movement. An independent sample-dungeon heap oracle confirms all 60 previously incorrect single-endpoint queries, with all 1,920 ordinary-cost controls unchanged. A separate many-to-many reconstruction correction handles the remaining 59 failures; both together match all 2,240 queries.

Full headless tests pass (324 passed, 95 skipped), using pinned native resource assets and SDL dummy audio. Mypy and applicable project formatting/hooks pass.

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.09%. Comparing base (84dd3bb) to head (76bda52).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #198   +/-   ##
=======================================
  Coverage   86.09%   86.09%           
=======================================
  Files          29       29           
  Lines        7597     7597           
=======================================
  Hits         6541     6541           
  Misses       1056     1056           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HexDecimal
HexDecimal merged commit 6587324 into libtcod:main Oct 17, 2026
31 checks passed
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.

2 participants