Added a readme.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user