private void SetGroupedLink(int tfx, int type, int no, UGrCells LA, UGrCells LB, bool Print = false) { if (LA.Count == 0 || LB.Count == 0) { return; } if (LA.Count == 1 && LB.Count == 1) { return; } GroupedLink GrpLK = new GroupedLink(LA, LB, tfx, type); int ix = GrpCeLKLst.FindIndex(P => (P.Equals(GrpLK))); if (ix >= 0) { return; } GrpCeLKLst.Add(GrpLK); if (Print) { WriteLine($"\r*LA tfx:{tfx} type:{type} no:{(no+1)}"); LA.ForEach(P => WriteLine(P)); WriteLine("*LB"); LB.ForEach(P => WriteLine(P)); } }
//Link in ALS(when 1-number is excluded and locked, other digits are in one house) public void QSearch_AlsInnerLink() { if (ALSLst == null) { PrepareALSLinkMan(1); } if (ALSLst.Count == 0) { return; } if (AlsInnerLink != null) { return; } foreach (var Pals in ALSLst.Where(p => (p.Size >= 2 && p.singly))) { List <int> noLst = Pals.FreeB.IEGet_BtoNo().ToList(); Permutation prm = new Permutation(noLst.Count, 2);//using permutation while (prm.Successor(2)) { int noS = noLst[prm.Index[0]]; int noD = noLst[prm.Index[1]]; UGrCells GS = Pals.SelectNoCells(noS); //ALS cell group with noS UGrCells GD = Pals.SelectNoCells(noD); //ALS cell group with noD Bit81 B81D = new Bit81(); GD.ForEach(q => B81D.BPSet(q.rc)); for (int tfx = 0; tfx < 27; tfx++) { if (!(B81D - pHouseCells[tfx]).IsZero()) { continue; } _SetGroupedLink(Pals, GS, GD, tfx); } } } if (AlsInnerLink == null || AlsInnerLink.Count <= 0) { return; } AlsInnerLink.Sort(); int ID = 0; AlsInnerLink.ForEach(P => P.ID = (ID++)); // AlsInnerLink.ForEach(P=>{ // // if( P.ALSbase.Size==2 && P.tfx==18 ){ // WriteLine($"ALSLink {P.UGCellsA.GCToString()} -> tfx:{P.tfx} {P.UGCellsB.GCToString()}" ); // // } // } ); }