Skip to content

Commit 47aa6d6

Browse files
committed
Fix logic for last row
1 parent 355187c commit 47aa6d6

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,3 @@ There's one thing I didn't implement according to the instructions given at any
3737
https://weblog.jamisbuck.org/2010/12/29/maze-generation-eller-s-algorithm
3838

3939
http://www.neocomputer.org/projects/eller.html
40-
41-
TODO:
42-
- bigger maze sizes mess with the perfectness of the maze (maybe because you start reassigning sets?)

src/Row.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Row extends Component {
3232
}
3333

3434
generateNewSetId() {
35-
const index = this.props.index * 10;
35+
const index = this.props.index * Math.pow(10, this.props.width.toString().length)
3636
const id = index + this.currentCell;
3737
return id;
3838
}
@@ -135,6 +135,7 @@ class Row extends Component {
135135
const currentCellSetId = cells[this.currentCell].props.setID;
136136

137137
if (
138+
!this.props.lastRow &&
138139
this.willJoin() &&
139140
this.currentCell < this.props.width - 1 &&
140141
currentCellSetId !== cells[this.currentCell + 1].props.setID
@@ -149,7 +150,7 @@ class Row extends Component {
149150
if (cells[this.currentCell + 1] &&
150151
cells[this.currentCell + 1].props.setID !==
151152
cells[this.currentCell].props.setID) {
152-
cells = this.joinCellsToSet(cells, currentCellSetId, cells[this.currentCell].props.setID);
153+
cells = this.joinCellsToSet(cells, currentCellSetId, cells[this.currentCell + 1].props.setID);
153154
}
154155
}
155156

src/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ h1, p {
1515
justify-content: center;
1616
align-items: center;
1717
border: 1px solid white;
18-
font-size: 16px;
18+
font-size: 12px;
1919
}
2020

2121
.active {

0 commit comments

Comments
 (0)