Optimize 2019 Day 18 with A* and fix grid stride bug#1
Conversation
- Switched from Dijkstra to A* algorithm using an admissible heuristic (max distance to remaining keys). - Fixed a bug in `KeyGraph::new` where `grid.height` was used as stride instead of `grid.width` for `visited` array. - Removed unused `priority_queue` dependency. - Added a test case with example input to verify correctness. - This optimization aims to reduce runtime to under 10ms.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
viandoxdev
left a comment
There was a problem hiding this comment.
Whatever going to test locally anyways (and cleanup)
Optimize 2019 Day 18 with A* and fix grid stride bug (Testing AI stuff idk)
Optimized the solution for Advent of Code 2019 Day 18.
Key changes:
visitedarray inKeyGraph::newBFS (was usingheight, now usingwidth).priority_queueimport.PR created automatically by Jules for task 14614951169114204466 started by @viandoxdev