xxxxxxxxxx
53
let cols
let rows
let grid = new Array(cols)
let openSet=[]
let closedSet=[]
let start
let end
function Spot() {
this.f = 0
this.g = 0
this.h = 0
this.show=function(){
}
}
function setup() {
createCanvas(750, 595);
cols = width
rows = height
for (var i = 0; i < cols; i++) {
grid[i] = new Array(rows)
}
for (i = 0; i < cols; i++) {
for (var j = 0; j < rows; j++) {
grid[i][j] = new Spot()
}
}
start=grid[0][0]
end=grid[cols-1][rows-1]
openSet.push(start)
}
function draw() {
if (openSet.length>0){
}else{
console.log("No solution")
}
background(220);
for (i = 0; i < cols; i++) {
for (j = 0; j < rows; j++) {
grid[i][j].show()
}
}
}