gpt3-python-maze-solver
gpt3-python-maze-solver copied to clipboard
I asked GPT-3 to write a program to solve a maze. It did.
gpt3-python-maze-solver
I asked GPT-3 to write a program to solve a maze. It did.
See it in the playground.
How to use
- Clone the repo.
-
cd gpt3-python-maze-solver
-
python maze-solver.py && open solution.png
Instructions provided to GPT-3
Image of maze:
The maze walls will be black
The maze path will be white
The maze start will be a green pixel
The maze end will be a red pixel
Write a python program that does the following:
Load an image of a maze from the file "maze.png". It will meet the description of the maze above.
Analyze the image to find a solution to the maze. Use the a* pathfinding algorithm.
Produce an image which has a line drawing of the solution to the maze.
### Python code:
Results
Input
Output
Bugs
This solution it created had one bug, at the very last line where it attempted to save the image of the solution. I fixed it, and that was the only change.
It took several tries to get a version that worked, but this one did. It does not employ the A* algorithm, but it does find a solutiuon.