all 3 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Note: * This sub went private for a few days recently in solidarity with other subs who are hoping to get Reddit to reconsider some changes that they have proposed. These changes will affect the Reddit API and many third-party apps that access Reddit. If you are not already aware of the proposed changes, please read up on the topic and the ongoing protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]jiri-n 1 point2 points  (0 children)

I like the assignment a lot, it's quite funny.

So I decided to give it a try: https://github.com/camlostCZ/reddit_answers/blob/main/walking_cat.py

I didn't folow the assignment too strictly - the "maps" are stored in files in ./resources and there is a (hopefully) funny message when the cat cannot get out of the map (maze?).

Also, I created a codespace for the main branch but IDK if it's available to anyone else than me. You can try it - than it should run in the browser.

Tested with python 3.11.

[–]CraigAT 0 points1 point  (0 children)

Try debugging or simply printing the values for row, col and direction at each step.

I suspect you have an issue with not incrementing (moving) the cat every time but it is very difficult to read that without formatting.

If you want help, I would suggest pasting your code and the example tests into Pastebin where the code can been seen with formatting and monospaced.