Worked on making a maze solver GUI where the user can input a maze and specify the target point the user wants to find by a single mouse click. Implemented DFS Algorithm to find the path from starting to ending point in a maze.
In order to figure out how to traverse a maze through code, we first need to understand what depth-first search is. Depth-first search (sometimes referred to in this article as DFS) is a graph/tree traversal algorithm that follows a path as far as it can until it either, reaches the goal or has nowhere else to go. It’s almost like running as far as you can in one direction until you hit a wall. Hopefully that analogy helps clear up any lingering confusion. You might even be starting to see how we can use Depth-First Search to solve a maze!
AWT and Swing are used to develop window-based applications in Java. Awt is an abstract window toolkit that provides various component classes like Label, Button, TextField, etc., to show window components on the screen. All these classes are part of the Java.awt package.
On the other hand, Swing is the part of JFC (Java Foundation Classes) built on the top of AWT and written entirely in Java . The javax.swing API provides all the component classes like JButton, JTextField, JCheckbox, JMenu, etc.
The components of Swing are platform-independent, i.e., swing doesn't depend on the operating system to show the components. Also, the Swing's components are lightweight.
By now I’m sure you understand exactly how our traversal algorithm could generate the path. Which is just one of a couple of available paths. We learned about some graph theory, depth-first search, the call stack and how all of it applies to finding a path through a maze. I hope You all enjoyed reading this article as much as I enjoyed writing it!