-
Notifications
You must be signed in to change notification settings - Fork 0
/
GridBoolean.js
59 lines (54 loc) · 1.35 KB
/
GridBoolean.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// only rectangular grids are supported
export default class GridBoolean {
constructor() {}
static original2048() {
return this._createFullRectangle(4, 4);
}
static _createFullRectangle(rowCount, columnCount) {
const rows = [];
for (let i = 0; i < rowCount; i++) {
const row = [];
for (let j = 0; j < columnCount; j++) {
row.push(1);
}
rows.push(row);
}
return rows;
}
//used in tests, do not remove
static test1_7x6() {
return [
[1, 1, 0, 0, 1, 1],
[0, 0, 1, 1, 0, 0],
[0, 1, 1, 0, 1, 0],
[1, 0, 1, 0, 1, 0],
[1, 1, 0, 1, 1, 0],
[1, 1, 1, 1, 1, 1],
[0, 0, 0, 1, 1, 1]
];
}
//used in tests, do not remove
static test2_10x10() {
return [
[0, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 0, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 0, 1, 1, 1, 0, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
];
}
//used in tests, do not remove
static test3_4x4() {
return [
[1, 1, 0, 1],
[0, 1, 1, 1],
[1, 1, 1, 1],
[1, 0, 1, 1]
];
}
}