Beispiel #1
0
 public UFish(UFish BaseSet, int HouseC, Bit81 CoverB81, Bit81 FinB81, Bit81 CannFin)
 {
     this.BaseSet  = BaseSet;
     this.HouseB   = BaseSet.HouseB;
     this.HouseC   = HouseC;
     this.CoverB81 = CoverB81;
     this.FinB81   = FinB81;
     this.CannFin  = CannFin;
 }
Beispiel #2
0
        private void Debug_PattenPrint(UFish UF)
        {
            WriteLine("no=" + no + " sz=" + sz + "  BaseSet: " + UF.HouseB.HouseToString());
            Bit81  BPnoB = new Bit81(pBDL, 1 << no);
            string noST  = " " + no.ToString();

            for (int r = 0; r < 9; r++)
            {
                string st = "";
                BPnoB.GetRowList(r).ForEach(p => st += (p == 0? " .": noST));
                st += " ";
                UF.BaseB81.GetRowList(r).ForEach(p => st += (p == 0? " .": " B"));
                st += " ";
                (BPnoB - UF.BaseB81).GetRowList(r).ForEach(p => st += (p == 0? " .": " X"));
                WriteLine(st);
            }
        }
        private void _KrFish_FishResultEx(int no, int sz, UFish Bas, UFish Cov)
        {
            int   HB = Bas.HouseB, HC = Cov.HouseC;
            Bit81 PB = Bas.BaseB81, PFin = Cov.FinB81;
            Bit81 EndoFin = Bas.EndoFin, CnaaFin = Cov.CannFin;

            string[] FishNames = { "Xwing", "SwordFish", "JellyFish", "Squirmbag", "Whale", "Leviathan" };

            PFin -= EndoFin;
            try{
                int noB = (1 << no);
                foreach (var P in PB.IEGet_rc().Select(p => pBDL[p]))
                {
                    P.SetNoBBgColor(noB, AttCr, SolBkCr);
                }
                foreach (var P in PFin.IEGet_rc().Select(p => pBDL[p]))
                {
                    P.SetNoBBgColor(noB, AttCr, SolBkCr2);
                }
                foreach (var P in EndoFin.IEGet_rc().Select(p => pBDL[p]))
                {
                    P.SetNoBBgColor(noB, AttCr, SolBkCr3);
                }
                foreach (var P in CnaaFin.IEGet_rc().Select(p => pBDL[p]))
                {
                    P.SetNoBBgColor(noB, AttCr, SolBkCr3);
                }

                string msg = "\r     Digit: " + (no + 1);
                msg += "\r   BaseSet: " + HB.HouseToString();
                msg += "\r  CoverSet: " + HC.HouseToString();;
                string msg2 = $" #{(no+1)} {HB.HouseToString().Replace(" ","")}/{HC.HouseToString().Replace(" ","")}";

                string FinmsgH = "", FinmsgT = "";
                if (PFin.Count > 0)
                {
                    FinmsgH = "Finned ";
                    string st = "";
                    foreach (var rc in PFin.IEGet_rc())
                    {
                        st += " " + rc.ToRCString();
                    }
                    msg += "\r    FinSet: " + st.ToString_SameHouseComp();
                }

                if (!EndoFin.IsZero())
                {
                    FinmsgT = " with Endo Fin";
                    string st = "";
                    foreach (var rc in EndoFin.IEGet_rc())
                    {
                        st += " " + rc.ToRCString();
                    }
                    msg += "\r  Endo Fin: " + st.ToString_SameHouseComp();
                }

                if (!CnaaFin.IsZero())
                {
                    FinmsgH = "Cannibalistic ";
                    if (PFin.Count > 0)
                    {
                        FinmsgH = "Finned Cannibalistic ";
                    }
                    string st = "";
                    foreach (var rc in CnaaFin.IEGet_rc())
                    {
                        st += " " + rc.ToRCString();
                    }
                    msg += "\r  Cannibalistic: " + st.ToString_SameHouseComp();
                }

                string Fsh = FishNames[sz - 2];
                int    bf = 0, cf = 0;
                for (int k = 0; k < 3; k++)
                {
                    if (((Bas.HouseB >> (k * 9)) & 0x1FF) > 0)
                    {
                        bf |= (1 << k);
                    }
                    if (((Cov.HouseC >> (k * 9)) & 0x1FF) > 0)
                    {
                        cf |= (1 << k);
                    }
                }
                if ((bf + cf) > 3)
                {
                    Fsh = "Franken/Mutant " + Fsh;
                }
                Fsh        = "Kraken " + FinmsgH + Fsh + FinmsgT;
                ResultLong = Fsh + msg;
                _krfMsg2   = Fsh.Replace("Franken/Mutant", "F/M") + msg2;
                Result     = _krfMsg2;
            }
            catch (Exception ex) {
                WriteLine(ex.Message);
                WriteLine(ex.StackTrace);
            }
        }
Beispiel #4
0
        public IEnumerable <UFish> IEGet_BaseSet(int BaseSel, bool FinnedF = false, bool EndoFlg = false)
        {
            if (HBLst == null)
            {
                yield break;
            }

            bool basicFish = (BaseSel.BitCount() <= 9) & !FinnedF;  //not F/M & notF/M
            int  BaseSelR  = 0x3FFFF ^ BaseSel;

            GeneralLogicGen.ChkBas1 = 0;
            GeneralLogicGen.ChkBas2 = 0;
            Bit81       Q;
            Combination cmbBas = new Combination(HBLst.Count, sz);
            int         nxt    = int.MaxValue;

            while (cmbBas.Successor(nxt))
            {
                int   chk1   = ++GeneralLogicGen.ChkBas1;
                int   usedLK = 0;
                Bit81 HB81   = new Bit81();
                Bit81 OHB81  = new Bit81();
                int   rcbB   = 0;
                for (int k = 0; k < sz; k++)
                {
                    nxt = k;
                    int    nx  = cmbBas.Index[k];
                    Bit81F HBF = HBLst[nx];
                    if (((1 << HBF.ID) & BaseSel) == 0)
                    {
                        goto nxtCmb;
                    }
                    if (!(Q = HB81 & HBF).IsZero())        //overlap
                    {
                        if (!EndoFlg)
                        {
                            goto nxtCmb;
                        }
                        OHB81 |= Q;
                    }
                    usedLK |= 1 << HBF.ID;              //house Number
                    HB81   |= HBF;                      //Bit81
                    rcbB   |= HBF.rcbB;
                    if (basicFish && k > 0 && (rcbB & BaseSelR).BitCount() > sz)
                    {
                        goto nxtCmb;
                    }
                }
                if (extFlag && !IsLinked9(HB81))
                {
                    continue;
                }
                int chk2 = ++GeneralLogicGen.ChkBas2;

                UFish UF = new UFish(no, sz, usedLK, HB81, OHB81);
                //if(sz>=3 && BaseSel==0x7FFFFFF) Debug_PattenPrint(UF);
                yield return(UF);

nxtCmb:
                continue;
            }
            yield break;
        }
Beispiel #5
0
        public IEnumerable <UFish> IEGet_CoverSet(UFish BSet, int CoverSel, bool Finned, bool CannFlg = false)
        {
            if (HBLst == null)
            {
                yield break;
            }

            List <Bit81> HCLst = new List <Bit81>();

            foreach (var P in HBLst.Where(q => (BSet.HouseB & (1 << q.ID)) == 0))
            {
                if (((1 << P.ID) & CoverSel) == 0)
                {
                    continue;
                }
                if (BSet.BaseB81.IsHit(P))
                {
                    HCLst.Add(P);
                }
            }
            if (HCLst.Count < sz)
            {
                yield break;
            }

            Bit81       Q;
            Combination cmbCov = new Combination(HCLst.Count, sz);
            int         nxt    = int.MaxValue;

            while (cmbCov.Successor(nxt))
            {
                int chk1 = ++GeneralLogicGen.ChkCov1;

                int   usedLK = 0;
                Bit81 HC81   = new Bit81();
                Bit81 OHC81  = new Bit81();
                for (int k = 0; k < sz; k++)
                {
                    nxt = k;
                    int nx = cmbCov.Index[k];
                    if (!(Q = HC81 & HCLst[nx]).IsZero()) //overlap
                    {
                        if (!CannFlg)
                        {
                            goto nxtCmb;
                        }
                        OHC81 |= Q;
                    }
                    usedLK |= 1 << HCLst[nx].ID; //house Number
                    HC81   |= HCLst[nx];         //Bit81
                }

                Bit81 FinB81 = BSet.BaseB81 - HC81;
                if (Finned != (FinB81.Count > 0))
                {
                    continue;
                }
                UFish UF = new UFish(BSet, usedLK, HC81, FinB81, OHC81);
                //if(sz>=3 && CoverSel==0x7FFFFFF)  WriteLine("  CoverSet: " + UF.HouseC.HouseToString() ); //**********
                yield return(UF);

nxtCmb:
                continue;
            }
            yield break;
        }