So the AI wants to get from green to red. Click to set where the start (green) and the end (red) goes. The AI slowly learns to get from the green to red without going out of the boundary (the black). It usually takes at least 6-8 tries, but if u give it smth tough, it may take 20-30 tries. If it starts going backward or isn't making any progress after 30, you should restart it.
I made most of the code at 3am, so tell me if it don't work