Added a readme.

This commit is contained in:
2021-02-08 00:19:30 -06:00
parent 7405f88bd6
commit 6f23674730
4 changed files with 79 additions and 19 deletions
+14 -2
View File
@@ -1,5 +1,17 @@
var maze = {};
var algo = {};
var targetCell = {};
function mouseClicked(){
if(mouseX > width || mouseY > height) return;
//let x = floor(maze.columns * maze.cellWidth / mouseX);
//let y = floor(maze.rows * maze.cellWidth / mouseY);
let x = floor(mouseX / maze.cellWidth);
let y = floor(mouseY / maze.cellWidth);
maze.grid[maze.index(x, y)].color = [0, 0, 0];
redraw();
}
function setup() {
var canvas = createCanvas(500, 500);
@@ -33,8 +45,8 @@ function draw() {
algo = new DepthFirstSolver(maze.grid[0], maze.grid[maze.index(7, 7)]);
else if(selectedAlgo == "breadthFirst")
algo = new BreadthFirstSolver(maze.grid[0], maze.grid[maze.index(7,7)]);
//else if(selectedAlgo == "a*")
else if(selectedAlgo == "greedy")
algo = new GreedyDepthFirstSolver(maze.grid[0], maze.grid[maze.index(7,7)]);
print("Maze generation done");
frameRate(Number(document.getElementById("solvingFrameRate").value));
}