Refactor EntityBehavior SEEK/FLEE to use PathProvider strategy; refs #315
EntityBehavior no longer holds a direct DijkstraMap reference. A new PathProvider interface has three concrete implementations: - DijkstraProvider: steps along a (possibly inverted) DijkstraMap. SEEK descends a normal map toward roots; FLEE descends an inverted map away from threats. - AStarProvider: follows a pre-computed AStarPath step-by-step. - TargetProvider: takes a single (x, y) target and picks the Chebyshev neighbor closest to it each turn. Entity.set_behavior() gains a pathfinder= kwarg accepting any of the above (DijkstraMap, AStarPath, or (x, y) tuple). The old executeSeek/executeFlee helpers collapse into a single executeProviderStep() that delegates to the provider. EntityBehavior.h forward-declares PathProvider so the header stays light. EntityBehavior::reset() moves out of line to avoid pulling PathProvider into the header. New tests: tests/regression/issue_315_path_provider_test.py covers all three providers driving SEEK, FLEE via inverted DijkstraMap, mid-run pathfinder swap, and invalid-argument handling. grid_step_bench baseline refreshed against the new provider dispatch path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
767d0d4b0f
commit
17f2d6e1ef
7 changed files with 349 additions and 82 deletions
|
|
@ -2,8 +2,8 @@
|
|||
"grid": "100x100",
|
||||
"entities": 100,
|
||||
"rounds": 1000,
|
||||
"total_sec": 0.07824495097156614,
|
||||
"mean_round_ms": 0.07824495097156614,
|
||||
"p95_round_ms": 0.1227830071002245,
|
||||
"per_entity_step_us": 0.7824495097156614
|
||||
"total_sec": 0.06852402002550662,
|
||||
"mean_round_ms": 0.06852402002550662,
|
||||
"p95_round_ms": 0.09302806574851274,
|
||||
"per_entity_step_us": 0.6852402002550662
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue