A collection of search algorithms from Russel & Norvig's Artificial Intelligence: A Modern Approach, implemented early 2020 by Jayden Milne (@jaydenmilne)
Left clicking and dragging on a wall cell will remove walls.
While the search is running, press the play/pause button () to pause the search, and then use the step button () to advance the search one state at a time.
I started working on this for fun, but then realized it could count as a class project, so I put some extra effort.
I hadn't had much experience with some new Javascript features (canvas, async/await, classes), and this seemed like a good chance to learn.
A rough estimate of how many steps were required to find the solution. For example, for depth-first searches, it is the number of recursive calls. For breadth-first searches, it is the number of iterations of the main loop.
The most I did was implement touch events, you should feel lucky you even got that much.
By default algorithms will only consider 4-connected neighbors (up, down, left, right).
If selected, the "8-connected checkbox" will consider diagonal moves as well.
4 | ||
3 | 2 | |
1 |
1 | 4 | 6 |
2 | 7 | |
3 | 5 | 8 |