[Community Puzzle] Escaping the cat

You are very welcome, I am really happy to read this kind of feedback. Impementing graphic solvable puzzles provides new approaches to collaborate with the coding game ecosystem. This is anyway a lot of work to make it working and stable, coding the cat behavior is also very challenging !! I will give a big thanks to my daugther who did provide the cute graphics for the scene around the swimmimg pool.


In the English puzzle’s description for “Escaping the cat”, the french word “Contraintes” wasn’t translated.

I congratulate your ‘art director’, her contribution enhanced the user experience greatly! :slight_smile:
I liked the puzzle itself as well, though the narrow margin for error in some test cases made it a bit challenging.

Well that challenged me quite a lot to be honest :sweat_smile:
But great idea!

I made the mouse swim in a circle of a radius where I could outrun the cat and make it to the pool edge first if the angle between the cat and the mouse was at it’s maximum.

So I’ve calculated the angle in each turn. A problem was that I’ve never saw an angle bigger than 175°. So I’ve stopped at 175° and skewed my escape route by another 5° :smiley: That made my mouse escape from the cat.

Can anybody help me? I can’t pass the final test. I’ve implemented a system of cardinal points, every time the cat moves I test the distance between it and the mouse. If it’s too close I send the mouse the other way around, but I can’t get fast enough onthe border, even with the cat a diameter far.

Does any of the previous discussion here help you?

Igolus’ link was a huge help in understanding a solution.
That said I got tired of trying to get the math to work and had my mouse zig zag for a bit, gaining distance the whole time. It forced the cat to keep changing direction, buying the mouse time until it couldn’t outpace the cat’s angle and made a rush to the edge (which itself could have been more efficient. I just have it go straight in a given cardinal direction instead of at some angle).
The last one is very tight and will make you need to be pretty efficient. I had to make an adjustment to my code specifically for how tight that one got.
Loved this puzzle. But I think I’ll go back and solve it as intended too. There’s a lot to think about and plenty of math to figure.

1 Like

how did you calculate the arclenght without knowing wich points are in the circle of the pool?

What’s the cat speed on “Furious cat” validator ? Cuz I pass it on IDE Test but not on validator I have no idea what’s going wrong


The speed is the same for all validators, only intial positions of cat and mouse are changed.

1 Like

The cat speed on “Furious cat” validator is the same as on “Furious cat” testcase (39).
To be sure you can add the cat speed to your output to be displayed in replays (located in Results → Details) as stated in the Output section of the puzzle description.
Example in python 3: print(f"0 0 Speed: {cat_speed}")


The code of the reteree can be find at: GitHub - igolus/escapingTheCat: escapingTheCat codingame, Complex number approach could help somehow…

1 Like

Finally made it thanks to the video! :star_struck: Really like the explanations, and the approach which is totally counter intuitive indeed!
Was stuck for ages at 75%, missing the last test case. I had to completely rewrite my code following the video. Very interesting problem. Thanks again for the video, without it I surely wouldn’t have been able to solve the puzzle (kind of hard, I found).


You might get a timeout if you don’t print out anything. Make sure that in any case your code has a print.

I found a bug. The mouse got out of the pool but I still got the “LOSER!” message.


Wow. Tell us which test or validator it is?

Same problem was with me, Your solution for this is to the point, Thanks a lot :+1:

I can’t even solve the first one but I just started coding :sweat_smile:

The previous discussion here may help you. But this puzzle can be difficult for a beginner, and you may consider switching to an easier puzzle first before coming back for another attempt at this one.