@logic-pad/core 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,7 +26,9 @@ class BanPatternRule extends Rule {
|
|
|
26
26
|
});
|
|
27
27
|
this.pattern = pattern
|
|
28
28
|
// unlock all tiles
|
|
29
|
-
.withTiles(tiles => tiles.map(row => row.map(t => t.
|
|
29
|
+
.withTiles(tiles => tiles.map(row => row.map(t => t.exists
|
|
30
|
+
? t.withFixed(false)
|
|
31
|
+
: t.copyWith({ exists: true, color: Color.Gray, fixed: false }))))
|
|
30
32
|
// strip all symbols and rules
|
|
31
33
|
.withRules([])
|
|
32
34
|
.withSymbols(new Map());
|
|
@@ -42,7 +42,6 @@ export default class DirectionLinkerBTModule extends BTModule {
|
|
|
42
42
|
this.initialPositions = this.getInitialPositions();
|
|
43
43
|
const tilesNeedCheck = IntArray2D.create(grid.width, grid.height);
|
|
44
44
|
const ratings = [];
|
|
45
|
-
let checkable = false;
|
|
46
45
|
for (const pos of this.initialPositions) {
|
|
47
46
|
const tile = grid.isInBound(pos.x, pos.y)
|
|
48
47
|
? grid.getTile(pos.x, pos.y)
|
|
@@ -53,6 +52,10 @@ export default class DirectionLinkerBTModule extends BTModule {
|
|
|
53
52
|
grid.getTile(oppoPos.x, oppoPos.y) === BTTile.NonExist)
|
|
54
53
|
return false;
|
|
55
54
|
else {
|
|
55
|
+
if (grid.getTile(oppoPos.x, oppoPos.y) === BTTile.Empty) {
|
|
56
|
+
tilesNeedCheck.set(oppoPos.x, oppoPos.y, 1);
|
|
57
|
+
ratings.push({ pos: oppoPos, score: 1 });
|
|
58
|
+
}
|
|
56
59
|
tilesNeedCheck.set(pos.x, pos.y, 1);
|
|
57
60
|
ratings.push({ pos, score: 1 });
|
|
58
61
|
}
|
|
@@ -69,20 +72,18 @@ export default class DirectionLinkerBTModule extends BTModule {
|
|
|
69
72
|
if (oppoPos !== null) {
|
|
70
73
|
const oppoTile = grid.getTile(oppoPos.x, oppoPos.y);
|
|
71
74
|
if (oppoTile === BTTile.Empty) {
|
|
72
|
-
tilesNeedCheck.set(
|
|
73
|
-
ratings.push({ pos, score: 1 });
|
|
75
|
+
tilesNeedCheck.set(oppoPos.x, oppoPos.y, 1);
|
|
76
|
+
ratings.push({ pos: oppoPos, score: 1 });
|
|
74
77
|
}
|
|
75
78
|
else if (oppoTile === BTTile.NonExist)
|
|
76
79
|
return false;
|
|
77
|
-
else
|
|
78
|
-
checkable = true;
|
|
79
80
|
}
|
|
80
81
|
else {
|
|
81
82
|
return false;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
if (
|
|
86
|
+
if (ratings.length > 0) {
|
|
86
87
|
return { tilesNeedCheck, ratings };
|
|
87
88
|
}
|
|
88
89
|
const queue = this.initialPositions
|