File tree Expand file tree Collapse file tree 5 files changed +18
-30
lines changed
Expand file tree Collapse file tree 5 files changed +18
-30
lines changed Original file line number Diff line number Diff line change 11# Pathfiding Algorithms Visualized
22
3- <img width =" 400 " src =" https://i.postimg.cc/RFG3VL3W/Capture33 .png " >
3+ <img width =" 600 " src =" https://i.postimg.cc/T3Mrkg6N/Capture .png " >
44
55## About
66
77Here you can see in realtime how pathfiding algorithms works. You can also draw walls and move the start and end point.
88
9- This include :
9+ Features :
1010
11- * ` A* `
12- * ` Dijkstra ` (modified version because here is not a cost graph)
11+ * draw (left click) & remove (right click) walls
12+ * live searching
13+ * draw/remove walls after the search ends
14+ * move end point and see instantly the path
15+
16+ Pathfiding algorithms used :
1317
14- Soon :
15- * ` Prim `
18+ * ` A* `
19+ * ` Dijkstra `
1620
1721## How To Run
1822
19- In order to run this, you'll need to install [ Processing] ( https://processing.org/ ) first. Open Sketch.pde under Sketch folder and you are done.
23+ In order to run this, you'll need to install [ Processing] ( https://processing.org/ ) first. Open Sketch.pde under Sketch folder and you are done.
24+ Also you must have the GUI library installed : [ ControlP5] ( http://www.sojamo.de/libraries/controlP5/ )
2025
2126## Credits
2227
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ class AStar extends Pathfiding{
77 super (arr);
88 super . priorityQueue = new PriorityQueue<Node > (1 , new DistanceFComparator ());
99 }
10-
10+ int k = 0 ;
1111 // HERE IS THE A* ALGORITHM
1212 @Override
1313 public void run (){
14-
14+ super . priorityQueue . clear();
1515 startNode. gScore = 0 ;
1616 super . priorityQueue. add(startNode);
1717
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ public class Node{
4747 // IF THE SELECTED CELL IS NOT START OR END NODE THEN
4848 // MAKE IT BLOCKED
4949 else if (this != startNode && this != endNode){
50+ this . resetNode();
5051 nodeColor = color (25 );
5152 isBlocked = true ;
5253 }
Original file line number Diff line number Diff line change @@ -85,9 +85,9 @@ class Pathfiding implements Runnable{
8585 private void getPath (){
8686 this . t = null ;
8787 Node temp = endNode;
88- while (temp != null ){
89- temp. nodeColor(pathColor);
90- temp = temp. parent;
88+ while (temp != null && temp != startNode ){
89+ temp. nodeColor(pathColor);
90+ temp = temp. parent;
9191 }
9292 return ;
9393 }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments