This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

jwilshire
jwilshire presents ...

2020/6/9

BFS vs DFS Ant Maze

Two ants race to solve a maze(if possible). The paths that are ultimately decided on are drawn in two different colors (overlap in a mix color).
Each ants paths can be turned off by calling a method to hidePaths.
This simulation demonstrates that while a depth first search for a maze solution is found quicker (typically), the breath first search finds the optimal (shortest) paths.
The classes include nested Lists, Nodes, and Queues or Stacks that are hand made to demonstrate the data structures

1662 views / 1206 in the last 7 days

Tags: simulation with-source stack queue algorithms depthfirstsearch breathfirstsearch lists

open in greenfoot
Your browser does not support the canvas tag.

No Comments

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.