Added furth UI behavior tweaks, removed a script and moved the p5.min.js into the repo.
This commit is contained in:
@@ -2,6 +2,9 @@ class MazeSolver {
|
||||
constructor(startingCell, targetCell, searchedColor = [210, 180, 140], finalPathColor = [173, 216, 230]){
|
||||
this.frontier = [];
|
||||
this.explored = [];
|
||||
|
||||
this.startingCellColor = [255, 0, 0];
|
||||
this.endingCellColor = [0, 0, 255];
|
||||
this.finalPathColor = finalPathColor;
|
||||
this.targetCell = targetCell;
|
||||
this.startingCell = startingCell;
|
||||
@@ -20,8 +23,16 @@ class MazeSolver {
|
||||
highlightFinalPath(maze){
|
||||
let tmp = this.explored.pop();
|
||||
|
||||
tmp.color = this.endingCellColor;
|
||||
|
||||
tmp = tmp.parent;
|
||||
|
||||
while(tmp != undefined){
|
||||
tmp.color = this.finalPathColor;
|
||||
|
||||
if(tmp.parent == undefined)
|
||||
tmp.color = this.startingCellColor;
|
||||
|
||||
tmp = tmp.parent;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user