//Link by ALS-ALS RCC
        public void QSearch_ALS2ALS_Link(bool doubly)
        {
            if (ALSLst == null)
            {
                PrepareALSLinkMan(1);
            }

            if (ALS2ALS_Link)
            {
                return;
            }
            ALS2ALS_Link = true;

            var cmb = new Combination(ALSLst.Count, 2);

            while (cmb.Successor())
            {
                UALS UA = ALSLst[cmb.Index[0]];
                UALS UB = ALSLst[cmb.Index[1]];

                int RCC = Get_AlsAlsRcc(UA, UB);
                if (RCC == 0)
                {
                    continue;
                }
                if (!doubly && RCC.BitCount() != 1)
                {
                    continue;
                }

                if (UA.ConnLst == null)
                {
                    UA.ConnLst = new List <UALSPair>();
                }
                if (UB.ConnLst == null)
                {
                    UB.ConnLst = new List <UALSPair>();
                }
                foreach (var no in RCC.IEGet_BtoNo())
                {
                    UALSPair LKX = new UALSPair(UA, UB, RCC, no);
                    if (!UA.ConnLst.Contains(LKX))
                    {
                        UA.ConnLst.Add(LKX);
                    }
                    LKX = new UALSPair(UB, UA, RCC, no);
                    if (!UB.ConnLst.Contains(LKX))
                    {
                        UB.ConnLst.Add(LKX);
                    }
                }
            }
        }
        private bool _CheckSolution_ALSChain(UALSPair LK0, UALSPair LKn, Bit81 rcUsed, Stack <UALSPair> SolStack)
        {
            int ElmBH = LK0.ALSpre.FreeB.BitReset(LK0.nRCC);    //non-RCC digit of First ALS
            int ElmBT = LKn.ALSnxt.FreeB.BitReset(LKn.nRCC);    //non-RCC digit of Last ALS
            int ElmB  = ElmBH & ElmBT;

            if (ElmB == 0)
            {
                return(false);                                  //if no common digits then Failure.
            }
            foreach (int Eno in ElmB.IEGet_BtoNo())             //Eno is one of common digits
            {
                int   EnoB = (1 << Eno);
                Bit81 Ez   = new Bit81();                       //Negative cell candidate
                foreach (var P in LK0.ALSpre.UCellLst.Where(p => (p.FreeB & EnoB) > 0))
                {
                    Ez.BPSet(P.rc);
                }
                foreach (var P in LKn.ALSnxt.UCellLst.Where(p => (p.FreeB & EnoB) > 0))
                {
                    Ez.BPSet(P.rc);
                }

                Bit81 TBD = (new Bit81(pBDL, EnoB)) - rcUsed;        //Exclude cells in the chain
                foreach (var rc in TBD.IEGet_rc())
                {
                    if ((Ez - ConnectedCells[rc]).IsZero())
                    {
                        pBDL[rc].CancelB |= EnoB; SolCode = 2;
                    }                                                                            //found solution
                }
            }

            if (SolCode > 0)
            {
                _SolResult_ALSChain(SolStack);

                if (__SimpleAnalizerB__)
                {
                    return(true);
                }
                if (!pAnMan.SnapSaveGP(true))
                {
                    return(true);
                }
            }
            return(false);
        }
        private bool _Search_ALSChain(UALSPair LK0, UALSPair LKpre, Stack <UALSPair> SolStack, int szCtrl, ref bool limitF)
        {
            int nRccPre = LKpre.nRCC;

            foreach (var LKnxt in LKpre.ALSnxt.ConnLst.Where(p => (p.nRCC != nRccPre)))
            {
                UALS UAnxt = LKnxt.ALSnxt;                            //Next connected ALS
                if (!UAnxt.singly)
                {
                    continue;
                }
                int szCtrlX = szCtrl - UAnxt.Size;                    //ChainsSize:Accumulation of ALS size
                if (szCtrlX < 0)
                {
                    limitF = true; return(false);
                }                                                   //Upper limit of ChainsSize has been exceeded
                if (!(LKpre.rcUsed & UAnxt.B81).IsZero())
                {
                    continue;             //Stop if the next node has been searched
                }
                {                         //===== Extend the link and try ahead =====
                    SolStack.Push(LKnxt); //Push the next Link onto the stack

                    Bit81 rcUsedNxt = LKpre.rcUsed | UAnxt.B81;
                    if (_CheckSolution_ALSChain(LK0, LKnxt, rcUsedNxt, SolStack))
                    {
                        return(true);               //Check the solution
                    }
                    LKnxt.rcUsed = rcUsedNxt;       //Used cells in the current phase of recursive search
                    if (_Search_ALSChain(LK0, LKnxt, SolStack, szCtrlX, ref limitF))
                    {
                        return(true);      //Recursive Search
                    }
                    SolStack.Pop();        //Pop:Return trial
                }
            }
            return(false);
        }