Maze AI

by joecooldoo
See Code Download Embed
Finally managed to make an AI that solves a maze.

It solves it quickly as well. If it gets jammed, it will fix itself. Don't worry. It can take a few tries before it reaches the end. Just be patient.

You can also make your own maze. Just draw the map, set the Start X and Start Y variables at the start of the script to the starting position, go to the Finish sprite, and change the go to x y to the end area you want the bot to finish at.

In case your wondering how it works, it calculates the longest distance, goes to the area with the longest distance, creates a blockade so it doesn't retrace its steps on accident. Then it un-jams itself. It repeats this until it is touching the finish.

Created November 22, 2021

Last updated November 29, 2021

Published November 22, 2021