private static LMRecord2D_Retangular Match_Internal(SlotWrapper2D[,] slots, int x, int y, RuleMatchBasic2D_Rectangular matchRule) { var sample = slots[y + matchRule.scatters[0].y, x + matchRule.scatters[0].x]; if (!sample.IsTarget) { return null; } for (int i = 1; i < matchRule.scatters.Length; ++i) { var sniff = slots[y + matchRule.scatters[i].y, x + matchRule.scatters[i].x]; if (!sniff.IsTarget) { return null; } if (!sample.slotAttribute.trait.AbsoluteEqual(sniff.slotAttribute.trait)) { return null; } } var record = new LMRecord2D_Retangular(); record.x = x; record.y = y; record.rule = matchRule; return record; }
public void SetSlot(int x, int y, SlotWrapper2D slot) { ClearSlot(x, y); wrapperRect[y, x] = slot; slot.pos.x = x; slot.pos.y = y; }
private SlotWrapper2D WrapSlot(SlotAttribute s, int x, int y) { var ret = new SlotWrapper2D(); ret.slotAttribute = s; ret.pos.x = x; ret.pos.y = y; return(ret); }
private Tuple<Pos2D, int> DepthFirstSearch(SlotWrapper2D[,] slots, FillInfo[,] infos, int fromX, int fromY) { Tuple<Pos2D, int> ret = null; var fi = infos[fromY, fromX]; foreach (var t in fi.childrenPos) { if (null == slots[t.y, t.x]) { var branchSearch = DepthFirstSearch(slots, infos, t.x, t.y); if (null == ret || branchSearch.item2 > ret.item2) { ret = branchSearch; } } } if (null == ret) { ret = new Tuple<Pos2D, int>(new Pos2D(fromX, fromY), 0); } else { ret.item2 = ret.item2 + 1; } return ret; }
private SlotWrapper2D WrapSlot(SlotAttribute s, int x, int y) { var ret = new SlotWrapper2D(); ret.slotAttribute = s; ret.pos.x = x; ret.pos.y = y; return ret; }