[Community Puzzle] Moves in maze

Hello
All the tests pass but when I submit the code I only get 86% because test 3 doesn’t pass.
Any kind soul to take a look and tell me what doesn’t pass?
Thank you

Thank you @Remi, @franca1s I was missing an important check in my algorithm.
@ElDadz the key for #3 is in this statement:

The maze is periodic: if you go left you appear on the right if there is no wall, and vice versa, similarly with up/down.

Yes test 3 is working before i submit
But when i submit it doesn’t work

Ok, I checked, and there is a difference between the test and the validator : in the validator your start on a border. Hope it helps you.

EDIT : you start on a border, but you don’t pass through the border at this point (wall on the opposite of the grid).

Maybe this custom test case can help you to debug :

6 3
...S.#
#####.
####..
32101#
#####4
####23

Hello Remi
Thank you for your answer
I just used your custom test case in vscode and it’s working properly, i get the same result as you

:thinking:
I don’t see any other difference between the test case and the validator.

Spoil : real validator
10 5
#.#####.S#
#.##..####
..##..#...
####..#.##
#....##.##

Hi,

All is good except validator 4. I can’t find why as I don’t know the input for it. Can someone help?

The only real difference I can see between the test and the validator, is that there’s a wall next to the start. Somthing like that :

..........
..S.......
.###......
..........

Thanks. Output is

3212345654
2101234543
3###345654
4323456765

Can’t see what’s wrong.

Validator sent in private message.

I get the right output, but validator is still wrong. Weird.

Solved thanks to @Remi.

There was a segmentation fault because I malloced a char** with sizeof(char) instead of sizeof(char*).

First thing you think is recursivity, function calling itself, that was easy to solve ! But I looked at some others solution and how Queue work to “avoid” the normal recursivity ?

You can code a BFS without recursivity.