Share your repls and programming experiences

← Back to all posts
Pathfinder II
h
kaldisberzins (259)

An improved version of my first path finding algorithm. This time it notes down each intersection and makes a choice there. If it later runs into a dead end it will jump back to that intersection and make a different choice. The dead end paths are marked in blue. The red path is the way to the end. It also will first pick a way that leads down because the end is at the bottom. Only if that is a dead end will it chose anther. I also switched out the maze for something a lot bigger because it would solve the smaller maze so fast that you did not get to see it. I recommend you open it in a new tab to see the whole maze. I hope you like it! Post any recommendations in the comments.

Commentshotnewtop
kaldisberzins (259)

Just timed it, it takes 2min and 22sec to complete the entire thing. With a pen and paper this could take you an hour.

tommydagun4 (0)

this sucks it kept my attention and left me deeply unsatisfied

shadowelite7 (0)

this is so cool, I would like to have something similar to this for my own screensaver

Reader8765 (17)

This is awesome! The biggest problem is that the Pathfinder is going back into areas it has already surrounded. It needs to learn to take more types of turns.

kaldisberzins (259)

@Reader8765 yeah, there is a problem with that.

Auhsoj1 (9)

@Reader8765 Also, when I zoomed out and/or changed tabs, this happened:

XavierDD (53)

It seems to very for time for me because I close the tab then reopen the pathfinder and it takes a different route some times. It gets longer or shorter depending on the route.

kaldisberzins (259)

@XavierDD really? I made it so that it would always take a certain direction first so I assumed that it would take the same path every time. Hmm, wierd.

XavierDD (53)

@kaldisberzins not always programs work in differant ways in diffrent operating systems and browsers.

kaldisberzins (259)

@XavierDD you may be right, arrays though should have a resonably universal behavior. Maybe it is something else.

Auhsoj1 (9)

@XavierDD I found that happening for me, too. Also, if I zoom out, the program runs faster.

ChandlerMorell (70)

This is insane! Congratulations! Is there any way you could add a timer??

kaldisberzins (259)

@ChandlerMorell i can and will add one but at this stage where there is only one maze it will always have the same time - 2:22.

ChandlerMorell (70)

@kaldisberzins Great! Yeah, that's true. Maybe you could a make an algorithm for a random maze? A new one each time.

kaldisberzins (259)

@ChandlerMorell an improvement I could make. If I have the time I could do something like that. Right now i can't but later I might make a new version of pathfinder.

ChandlerMorell (70)

@kaldisberzins I'm very intrigued, and I'd be happy to see it!

kaldisberzins (259)

@ChandlerMorell currently I am writing up a tutorial fot the competition. I might get around to another pathfinder after that.

ChandlerMorell (70)

@kaldisberzins Awesome! Good luck! Could you check out my tutorial? No where near as cool as yours though!

ChandlerMorell (70)

@kaldisberzins I'll definitely check it out!

nsedler (19)

This is so cool! I like how it changes the color to blue once it rules out that's not a correct path.