class Cell { constructor(x, y, cellWidth){ this.x = x; this.y = y; this.walls = [true, true, true, true]; this.visited = false; this.cellWidth = cellWidth; this.parent = undefined; this.color = [255, 255, 255, 0]; } get defaultColor(){ return [255, 255, 255, 0]; } get top(){ return this.walls[0]; } set setTop(removed){ this.walls[0] = removed; } get left(){ return this.walls[1]; } set setLeft(removed){ this.walls[1] = removed; } get bottom(){ return this.walls[2]; } set setBottom(removed){ this.walls[2] = removed; } get right(){ return this.walls[3]; } set setRight(removed){ this.walls[3] = removed; } show(){ let x = this.x * this.cellWidth; let y = this.y * this.cellWidth; stroke(0); if (this.top) line(x, y, x + this.cellWidth, y); if (this.right) line(x + this.cellWidth, y, x + this.cellWidth, y + this.cellWidth); if (this.bottom) line(x + this.cellWidth, y + this.cellWidth, x, y + this.cellWidth); if (this.left) line(x, y, x, y + this.cellWidth); fill(this.color); noStroke(); rect(x, y, this.cellWidth, this.cellWidth); } }