[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.

3 Likes

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

Hello,

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}")

2 Likes

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).
Cheers

2 Likes

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.

4 Likes

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.

interesting, i go center and after i move using the angle between my mouse and the cat. and use un delta with the cat_speed for the angle if the angle is big or little.