These are the scripts from @Griffpatch's Simple Pathfinding Tutorial. It will calculate the fastest route to get to the apple and move Scratch Cat to it. Controls: Drag the Apple to move it. Space key to make clones of Scratch cat that will go to the apple. You can change the mazes by going into the costumes section in the Maze sprite and selecting the one you want.
This is from @Griffpatch's awesome tutorial on making a Simple Pathfinding project. I would highly suggest checking out his videos at youtube.com/channel/UCawsI_mlmPA7Cfld-qZhBQA.