-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change dot cluster behavior #36
Conversation
Ok, this one should be good to go as well. I had to build it on top of #35 therefore I set that as the target branch for now but it should go into the demo branch. |
abe8f0c
to
e43d8a2
Compare
Rename clusterFinder to dotClusterFinder
b100b1b
to
063ae1e
Compare
I had to rebase on top of pacman-demo and resolve some minor conflics (introduced by the review changes of the previous PR, I guess) See also 063ae1e for some more optional use in A* – please check, if that makes sense 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, good work!
Some nits, some code improvements, some style suggestions. Feel free to move on after considering my feedback
Thanks for the rebase, the optional Path stuff (which I meant to add but obviously forgot) and the detailed review. I skimmed through it briefly and I'm afraid I agree with pretty much all of your suggestion 😂 |
Closes #26
This should be the final behavior 🥳
I did go for a cluster segmentation algorithm (just a simple breadth first search) as opposed to the quadrant thing we discussed since it seemed more sensible when I started implementing it.
So we now split the dots into clusters (sets of connected dots) using the clustering algorithm in
cluster.hpp
. I did move theMazeAdapter
andCell
class intomaze.hpp
and generalized it such that both the clustering algorithm and the A* could utilize these classes. For each cluster, we also compute the center by averaging the x and y coordinates and finding the dot closest to that position.Given the clusters and their respective centers. the new behavior now plans a path from the current position to the center of the closest cluster except for the one that pacman might already be in and commits to it until one of the cluster dots has been reached.
There is one relatively unrelated commit in here:
c27930e Fixes a bug that caused a crash when pacman entered the tunnel while chasing or avoiding a ghost. It was a lot easier to fix on this branch because the
positionConsideringTunnel
function has been moved out of the A* class.