GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reconsider settled pathfinder goals after adding roots by antonsoo · Pull Request #192 · libtcod/python-tcod

Conversation

@antonsoo

@antonsoo antonsoo commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Pathfinder.resolve(goal) returns immediately for a previously visited goal even when a new root is waiting in the frontier. Lowering an existing root's distance also leaves cached distances unchanged:

import numpy as np
import tcod.path

pf = tcod.path.Pathfinder(tcod.path.SimpleGraph(
    cost=np.ones((9, 13), np.int8), cardinal=1, diagonal=0))
pf.add_root((0, 0), value=7)
pf.resolve()
pf.add_root((0, 0), value=-3)
pf.resolve((8, 12))
print(pf.distance[8, 12])  # 27 before this change; should be 17.

When the frontier is nonempty, queue the visited goal at its current distance. The search can then find a shorter route, while the queued goal bounds the work if no improvement is possible. An empty frontier still returns immediately. Add regression coverage for C/F indexing, partial/full initial resolution, heuristics enabled/disabled and a cached-goal control that checks the search does not resolve the entire map.

On three MovingAI Dragon Age maps, 2,268 of 2,304 lazy queries retain stale distances after lowering a destination's weight. All distances match independent Dijkstra calculations with this change. In a separate integration run with #191, adding destinations produces 1,600 incorrect routes out of 2,304 before this change and none afterward. #191 addresses predecessor termination; this PR addresses when the frontier is searched. Each has a separate regression on current main.

Validation on Linux/Python 3.12 with the pinned native libtcod: 12 new cases fail before the change; all 14 pass afterward. The suite excluding window and audio tests passes (197 passed, 94 skipped); Mypy and project formatting hooks pass. Full audio-inclusive validation is incomplete: the dummy audio run stalls in stream binding, while the ordinary audio configuration lacks a device. No complete graphical/audio-suite pass is claimed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@antonsoo
Reconsider settled goals after adding pathfinder roots
e84b164
@codecov

codecov Bot commented Oct 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.05%. Comparing base (f801385) to head (e84b164).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #192      +/-   ##
==========================================
+ Coverage   86.03%   86.05%   +0.01%     
==========================================
  Files          29       29              
  Lines        7583     7586       +3     
==========================================
+ Hits         6524     6528       +4     
+ Misses       1059     1058       -1     

☔ 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@antonsoo antonsoo mentioned this pull request Oct 12, 2026
Keep root costs and traversal consistent when adding destinations #191
Merged
HexDecimal
HexDecimal approved these changes Oct 12, 2026
View reviewed changes
@HexDecimal
HexDecimal merged commit 50d805b into libtcod:main Oct 12, 2026
31 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@HexDecimal HexDecimal HexDecimal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@antonsoo @HexDecimal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.