-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcell.js
More file actions
27 lines (25 loc) · 667 Bytes
/
cell.js
File metadata and controls
27 lines (25 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Cell {
constructor(value,isNeighbour) {
this.collapsed = false;
this.neighbourOfCollapsed = isNeighbour; // optimization: entropy gets smaller only if neighbours are collapsed
this.noOptions = false; // in case of being stuck reset my neighbours
if (value instanceof Array) {
this.options = value;
} else {
this.options = [];
for (let i = 0; i < value; i++) {
this.options[i] = i;
}
}
}
setOptions(value) {
if (value instanceof Array) {
this.options = value;
} else {
this.options = [];
for (let i = 0; i < value; i++) {
this.options[i] = i;
}
}
}
}