Author Topic: Maze Solver  (Read 715 times)

yesterday i came up with the idea to make a script that would solve the maze save. i pulled it off, but the downside is, it's only a portion of the save.
i was debating if i should post this here, or the gallery, but since it involves coding, i put it here.
here's the video of it.

the script first finds what space is sitting right next to the start space, the one with the bot above it. then it finds the space next to the ending space. next, it focuses on the space adjacent to the start space, and it finds out the directions it can move from there, using raycasts. depending on the solution it is solving (the script picks the quickest out of three calculated), it will move in one of those directions, and this repeats until it hits a dead end, which makes the script go back and mark those spaces as "dead."
if the current space under focus is adjacent to the end space, the solution stops calculating and it records the number of spaces needed to walk. this process is repeated two more times, and then the script picks the solution with the least number of spaces to walk over. it highlights the path, and the bot will begin walking over it, soon reaching the end.
if the maze is accidentally/purposefully made unsolvable, the script will detect it, and the bot will remain stationary.

here's the code for it (just execute it in config/server or something)
save for it is attached

Hey that's cool, nice work.

Cool, you made your own pathfinding algorithm. Nice job.