Skip to content

Commit a83a4cc

Browse files
committed
WIP
1 parent 04d1f09 commit a83a4cc

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

src/variety/diamond.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@
141141
enabled: true,
142142
pointgroup: "cross",
143143
relation: {
144-
"cross.qans": "etc",
145-
"cell.qnum": "etc"
144+
"cross.qans": "other",
145+
"cell.qnum": "other"
146146
},
147147
setComponentRefs: function(obj, component) {
148148
obj.dblk = component;
@@ -170,6 +170,32 @@
170170
return cell.isNum();
171171
});
172172
},
173+
isedgevalidbynodeobj: function(nodeobj1, nodeobj2) {
174+
if (nodeobj1.qans === 1 || nodeobj2.qans === 1) {
175+
return true;
176+
} else if (nodeobj1.bx === nodeobj2.bx) {
177+
var c1 = this.board.getc(
178+
nodeobj1.bx - 1,
179+
(nodeobj1.by + nodeobj2.by) >> 1
180+
);
181+
var c2 = this.board.getc(
182+
nodeobj1.bx + 1,
183+
(nodeobj1.by + nodeobj2.by) >> 1
184+
);
185+
return c1.isNum() || c2.isNum();
186+
} else if (nodeobj1.by === nodeobj2.by) {
187+
var c1 = this.board.getc(
188+
(nodeobj1.bx + nodeobj2.bx) >> 1,
189+
nodeobj1.by - 1
190+
);
191+
var c2 = this.board.getc(
192+
(nodeobj1.bx + nodeobj2.bx) >> 1,
193+
nodeobj1.by + 1
194+
);
195+
return c1.isNum() || c2.isNum();
196+
}
197+
return false;
198+
},
173199
getSideObjByNodeObj: function(cross) {
174200
return new this.klass.CrossList([
175201
cross.relcross(0, -2),
@@ -182,6 +208,7 @@
182208
},
183209
modifyOtherInfo: function(obj, relation) {
184210
if (obj.group === "cross") {
211+
this.setEdgeByNodeObj(obj);
185212
var crosses = this.getSideObjByNodeObj(obj);
186213
for (var i = 0; i < crosses.length; i++) {
187214
this.setEdgeByNodeObj(crosses[i]);

0 commit comments

Comments
 (0)