Is it possible to beat circle the cat
Programming is not something that is on-topic on arqade. Add a comment. Active Oldest Votes. Give each square next to the edge of the board a DistanceToWin value of 1. Each square adjacent to a 1 gets a value of 2; next to a 2 gets a 3; etc.
Keep going until no new values are set. Notice that some squares may not have values set: these have no route to the edge, so if the cat is on one of these squares, it is trapped, and sooner or later, you are going to win. My thinking here is that this represents that the escape cannot be blocked: one more step, and you can't block two routes in one turn. The algorithm to trap the cat seems to fall into 3 categories: The cat is encircled DistanceToWin is not set for the cat's square , and just needs to be finally trapped.
For category 1, I'd suggest filling any square next to the cat. Category 2, fill the square which needs filling. Improve this answer. Richardissimo Richardissimo 5, 2 2 gold badges 13 13 silver badges 34 34 bronze badges. I'm trying this, and my "category 3" approach isn't great. Ironically, it's better to leave gaps, which makes the score higher, but entices the cat towards the gap, which you close at the last minute.
I'm going to try to adjust the Score towards counting the distinct escape routes. I'm also getting too many false positives in category 2, so I need to work on that. Thanks for the help, I used some of your tips and I got a great result.
Sign up or log in Sign up using Google. This situation is same as the previous case. Skip to content. Change Language. Related Articles. Table of Contents.
Save Article. Improve Article. Like Article. Previous Puzzle David and Goliath. Next Puzzle Truth and Lie. Recommended Articles. Article Contributed By :. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Classic Game "Circle the Cat" algorithm? Ask Question. Asked 9 years, 10 months ago. Active 7 months ago. Viewed 11k times. I'm just inquisitive here. Improve this question. I think it just uses breath first search nothing else — Saeed Amiri.
Add a comment. Active Oldest Votes. Happy coding. Improve this answer.
0コメント