Let’s code a very simple maze solver using depth first search algorithm 🙂 !
Note 1: this video does not explain the theoretical part.
Note 2: I’m overriding JFrame’s paint() method only as a convenience. Be warned though, in pratice, it’s not very recommended by more experienced programmers ok 🙂
Note 3: in the current implementation of DepthFirst class, all visited nodes of maze array will be filled with ‘2’ and won’t be cleaned up automatically.
Executable jar (java 6) –
Source:
View.java –
DepthFirst.java –
Reference:
Nguồn: https://zagran-tour.com/
Xem thêm bài viết khác: https://zagran-tour.com/game/
can u reupload the file used in the video?
I couldnt get it to work path = [] 🙁
what software are you using here?
hi firnd i have new video https://youtu.be/3wIPGvJ-1b0
When i make maze matrix bigger, i got error. Some exceptions…why
copied from stack overflow lol
Nice usefull video with lots of comments. Thanks!
Dude I have been looking for pathfinding tut for a while now and I must this is the best DFS java tut in the whole YouTube much appreciated.
The ball isnt moving in mine, what should I do?
Would this work if the positions of the starting and the ending points were reversed?
files are virused
Can u email me the source code on darshanajiwan@gmail.com
so if your map has larger empty spaces (aka rooms), the algorithm fills room with
unnecessary
paths.
Hi leo.,can i chat u in a private chat box? like email or messenger to ask some question about ur code?
How can we show all the paths that the ball has visited and in the last, show the shortest path
Hi, Why it's maze[y][x] not maze[x][y] and why the output of the path is inverted… sorry I am a newbie T_T
Thks man!
Can you please share your mail id. I have discussion about A* algorithm that I generated but I cannot implement the GUI.
Great Video man! Hey can you tell me how to stop the flickering when the ball moves ?
I like the speed
That helped me out alot
why so fast :/
You call that simple? I view it only in half speed.