Brute forcing a naive depth first path traversal

Because instead of applying for a job that I think fits with my needs, I somehow need to prove to myself that I can do this thing instead.  Because I want evidence to myself that I’m capable, a confidence building exercise, I guess…

Without reading, without quora, or wikipedia explaining to me, I want to know if I can resolve this problem on my own with the very little understanding I have.  As I said, it’s naive, and I know this is a “solved problem” but it’s solved because it’s easy.

I guess this is me proving to myself that I can tackle a topic I find interesting related to game design and use my brain power to do this on my own with as minimal research as possible.

Ordinarily I’d just look it up, I’m not a fool, trying to do something when there’s plenty of knowledge and answers out there without using the resources you have is a stubborn folly for any reason besides evidence of ones capabilities.  So I’m trying to think this through in my own messy fashion.  I think I should have a solution within a few hours (ho boy, putting a time limit to something I have no frame of reference for time, is gonna be interesting to see).

I think I have an interesting and fairly accurate approach to an algorithm and I think optimization can be had by asking why certain operations I’m doing to arrive at this solution are done in that way and not another.  In this case… literal edge cases LOL.