Skip to content

Commit f371431

Browse files
committed
Section 22: Guiding Comments
1 parent a5fe4bb commit f371431

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

22-Javascript-with-the-Canvas-API/02-Maze copy/index.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Matter.js library
22
const { Engine, Render, Runner, World, Bodies } = Matter
33

4-
const cells = 5
4+
const cells = 3
55
const width = 600
66
const height = 600
77

@@ -42,4 +42,29 @@ const horizontals = Array(cells - 1)
4242
.fill(null)
4343
.map(() => Array(cells).fill(false))
4444

45-
console.log(horizontals)
45+
// console.log(horizontals)
46+
47+
const startRow = Math.floor(Math.random() * 3)
48+
const startColumn = Math.floor(Math.random() * 3)
49+
50+
// console.log(startRow, startColumn);
51+
52+
const stepThroughCell = (row, column) => {
53+
// If i have visited the cell at [row, column], then return
54+
55+
// Mark this cell as being visited
56+
57+
// Assemble randomly-ordered list of neighbors
58+
59+
// For each neighbor....
60+
61+
// See if that neighbor is out of bounds
62+
63+
// If we have visited that neighbor, continue to next neighbor
64+
65+
// Remove a wall from either horizontals or verticals
66+
67+
// Visit that next cell
68+
}
69+
70+
stepThroughCell(startRow,startColumn)

22-Javascript-with-the-Canvas-API/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ console.log(grid)
5757

5858
## 9. 13 Verticals and Horizontals
5959

60-
## 10. 14 Abstracting Maze Dimensions
60+
## 10. 14 Abstracting Maze Dimensions
61+
62+
## 11. 15 Guiding Comments

0 commit comments

Comments
 (0)