Skip to content

Commit fcfcd1d

Browse files
committed
Let vertical join chance be opposite of horizontal, to get desired mazes when playing with join chances
1 parent 47aa6d6 commit fcfcd1d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Row.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class Row extends Component {
5353
setID = this.generateNewSetId();
5454
}
5555

56-
// // check if there will be a
57-
// // random vertical connection
58-
if (this.willJoin('vertical') && !this.props.lastRow) {
56+
// check if there will be a
57+
// random vertical connection
58+
if (this.willJoinVertical() && !this.props.lastRow) {
5959
walls = {
6060
...walls,
6161
bottom: false
@@ -73,6 +73,9 @@ class Row extends Component {
7373
this.currentCell += 1;
7474
}
7575

76+
willJoinVertical() {
77+
return 1 - this.props.chanceToJoin > Math.random();
78+
}
7679

7780
willJoin() {
7881
return this.props.chanceToJoin > Math.random();

0 commit comments

Comments
 (0)