Skip to content

Commit 81e1197

Browse files
committed
remove cell flash
1 parent 1bb30e2 commit 81e1197

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Pathfiding Algorithms Visualized
1+
# Pathfinding Algorithms Visualized
22

33
<img width="600" src="https://i.postimg.cc/T3Mrkg6N/Capture.png">
44

55
## About
66

7-
Here you can see in realtime how pathfiding algorithms works. You can also draw walls and move the start and end point.
7+
Here you can see in realtime how pathfinding algorithms works. You can also draw walls and move the start and end point.
88

9-
Features :
9+
Features :
1010

1111
* draw (left click) & remove (right click) walls
1212
* live searching
1313
* draw/remove walls after the search ends
1414
* move end point and see instantly the path
1515

16-
Pathfiding algorithms used :
16+
Pathfinding algorithms used :
1717

1818
* `A*`
1919
* `Dijkstra`

Sketch/AStar.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java.util.Comparator;
22
import java.util.PriorityQueue;
33

4-
class AStar extends Pathfiding{
4+
class AStar extends Pathfinding{
55

66
AStar(List<List<Node>> arr){
77
super(arr);

Sketch/Dijkstra.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java.util.Comparator;
22
import java.util.PriorityQueue;
33

4-
class Dijkstra extends Pathfiding{
4+
class Dijkstra extends Pathfinding{
55

66
Dijkstra(List<List<Node>> arr){
77
super(arr);

Sketch/Node.pde

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ public class Node{
3232

3333
if(!drawMode){
3434
explicitMode = false;
35-
switch(PathfidingAlgorithm){
35+
switch(PathfindingAlgorithm){
3636
case 1: dijkstra.start(); break;
3737
case 2: aStar.start(); break;
38+
3839
}
40+
// FOR REMOVING `CELL FLASH`
41+
try{ Thread.sleep(15); }
42+
catch(Exception e){}
3943
}
44+
4045
}
4146
} else if(startNodeMove){
4247
if(startNode != this && this != endNode){
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
class Pathfiding implements Runnable{
1+
class Pathfinding implements Runnable{
22
private List<List<Node>> matrix;
33
private PriorityQueue<Node> priorityQueue;
44
private Thread t;
55

6-
Pathfiding(List<List<Node>> arr){
6+
Pathfinding(List<List<Node>> arr){
77
this.matrix = arr;
88
}
99

10-
// HERE WILL BE THE PATHFIDING ALGORITHM
10+
// HERE WILL BE THE PATHFINDING ALGORITHM
1111
@Override
1212
public void run(){
1313
// look into the subclass

Sketch/Sketch.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ List<List<Node>> array;
88
Node startNode, endNode;
99
boolean MousePress, searchStarted;
1010
boolean startNodeMove, endNodeMove, undoWall, explicitMode, searchPaused, drawMode;
11-
int PathfidingAlgorithm;
11+
int PathfindingAlgorithm;
1212

1313
ControlP5 button;
1414
color startColor, endColor, openListColor, closedListColor, pathColor, bgColor;
@@ -140,7 +140,7 @@ void Reset(){
140140
drawMode = true;
141141
}
142142
void dijkstra(){
143-
PathfidingAlgorithm = 1;
143+
PathfindingAlgorithm = 1;
144144
searchPaused = false;
145145
explicitMode = true;
146146
if(dijkstra.canStart()){
@@ -150,7 +150,7 @@ void dijkstra(){
150150
}
151151
}
152152
void astar(){
153-
PathfidingAlgorithm = 2;
153+
PathfindingAlgorithm = 2;
154154
searchPaused = false;
155155
explicitMode = true;
156156
if(aStar.canStart()){

0 commit comments

Comments
 (0)