Skip to content

Commit 44e4c62

Browse files
committed
Section 22: Updating Horizontal Wall Values
1 parent 619d2f7 commit 44e4c62

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ const stepThroughCell = (row, column) => {
7777

7878
// Assemble randomly-ordered list of neighbors
7979
const neighbors = shuffle([
80-
// [row - 1, column, 'up'],
80+
[row - 1, column, 'up'],
8181
[row, column + 1, 'right'],
82-
// [row + 1, column, 'down'],
83-
// [row, column - 1, 'left'],
82+
[row + 1, column, 'down'],
83+
[row, column - 1, 'left'],
8484
])
8585
console.log(neighbors)
8686

@@ -103,12 +103,17 @@ const stepThroughCell = (row, column) => {
103103
verticals[row][column - 1] = true
104104
} else if (direction === 'right') {
105105
verticals[row][column] = true
106+
} else if (direction === 'up') {
107+
horizontals[row - 1][column] = true
108+
} else if(direction === 'down') {
109+
horizontals[row][column] = true
106110
}
107111
}
108112
// Visit that next cell
109113
}
110114

111-
// stepThroughCell(startRow, startColumn)
112-
stepThroughCell(1, 1)
115+
stepThroughCell(startRow, startColumn)
116+
// stepThroughCell(1, 1)
113117
// console.log(grid)
114-
console.log(verticals);
118+
// console.log(verticals);
119+
// console.log(horizontals);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ console.log(grid)
6868
## 14. 18 Determining Movement Direction
6969

7070
## 15. 19 Updating Vertical Wall Values
71+
72+
## 16. 20 Updating Horizontal Wall Values

0 commit comments

Comments
 (0)