I've been working on trying to solve mazes and output the path from start to the end. No matter what I do though, it never really works 100%. It manages to backtrack trough the whole maze like it should and find the end... but actually outputting ONLY the path that it should take won't work. It works on some of the generated mazes, but not generally. It also includes some of the dead-ends.
The problem is that i've probably tried 10 different DFS algorithms online, but none of them works. It's very confusing that so many different sites seem to have algorithms that doesn't work, i've implemented them practically literally.
Would be very kind if someone could give an actual working pseudocode of how to write a simple maze solver using stack that shows the relevant path to take. After 20-25 hours of experimenting I don't think I will get anywhere anymore.