public bool EndoFinnedFMFish_sub( int sz, int no, int FMSize, bool FinnedF, bool EndoF=false, bool CannF=false ){ int noB=(1<<no); int BaseSel=0x7FFFFFF, CoverSel=0x7FFFFFF; FishMan FMan=new FishMan(this,FMSize,no,sz,(sz>=3)); foreach( var Bas in FMan.IEGet_BaseSet(BaseSel,FinnedF:FinnedF,EndoFlg:EndoF) ){ //BaseSet foreach(var Cov in FMan.IEGet_CoverSet(Bas,CoverSel,CannF)){ //CoverSet if(pAnMan.CheckTimeOut()) return false; Bit81 FinB81 = Cov.FinB81 | Bas.EndoFin; Bit81 E=Cov.CoverB81-Bas.BaseB81; Bit81 ELM=new Bit81(); //see latest viewpoint foreach( var rc in E.IEGet_rc() ){ if((FinB81-ConnectedCells[rc]).Count==0) ELM.BPSet(rc); } if( ELM.Count>0 ){ foreach(var P in ELM.IEGetUCeNoB(pBDL,noB)){ P.CancelB=noB; SolCode=2; } if(SolCode>0){ if(SolInfoB){ _Fish_FishResult(no,sz,Bas,Cov,(FMSize==27)); //27:Franken/Mutant } //WriteLine(ResultLong); if(__SimpleAnalizerB__) return true; if(!pAnMan.SnapSaveGP(true)) return true; } } } } return false; }
public bool ExtKrFishSubEx(int sz, int no, int FMSize, bool FinnedF) { int BaseSel = 0x7FFFFFF, CoverSel = 0x7FFFFFF; int noB = (1 << no); string krfSolMsg = ""; FishMan FMan = new FishMan(this, FMSize, no, sz, (sz >= 3)); foreach (var Bas in FMan.IEGet_BaseSet(BaseSel, FinnedF:FinnedF)) //Generate BaseSet { foreach (var Cov in FMan.IEGet_CoverSet(Bas, CoverSel, FinnedF)) //Generate CoverSet { Bit81 FinB81 = Cov.FinB81; //dbCC++;//############## if (FinnedF != FinB81.IsZero()) { //WriteLine( $"dbCC:{dbCC} \rbas:{Bas.BaseB81}\rCov:{Cov.CoverB81}" );//###### //WriteLine( $"Bas.HouseB:{Bas.HouseB.ToBitString27()}"); //WriteLine( $"Cov.HouseB:{Cov.HouseC.ToBitString27()}"); Bit81 UsedB = Bas.BaseB81; foreach (var Hb in Bas.HouseB.IEGet_BtoNo(27)) { Bit81 E = Bas.BaseB81 & HouseCells[Hb]; if (FinnedF) { E |= FinB81; //Finned } if (E.IsZero()) { continue; } foreach (var P in pBDL.Where(p => !UsedB.IsHit(p.rc))) { foreach (var noZ in P.FreeB.IEGet_BtoNo()) { int noZb = (1 << noZ); USuperLink USLK = pSprLKsMan.get_L2SprLKEx(P.rc, no, FullSearchB: false, DevelopB: false); //WriteLine( $" USuperLink rc:{P.rc} no:{noZ+1}" ); if (!USLK.SolFound) { continue; } Bit81 Ef = E - USLK.Qfalse[no]; if (!Ef.IsZero()) { continue; } //Accurate analysis USLK = pSprLKsMan.get_L2SprLKEx(P.rc, noZ, FullSearchB: true, DevelopB: false);//##### Ef = E - USLK.Qfalse[no]; if (!Ef.IsZero()) { continue; } P.CancelB |= noZb; SolCode = 2; if (SolInfoB) { _KrFish_FishResultEx(no, sz, Bas, Cov); krfSolMsg += $"\r{_krfMsg2} r{(P.r+1)}c{(P.c+1)}/{(noZ+1)} is false"; foreach (var rc in E.IEGet_rc()) { krfSolMsg += "\r" + pSprLKsMan._GenMessage2false(USLK, pBDL[rc], no); } } //goto LSolFound; } } // LSolFound: if (SolCode > 0) { if (SolInfoB) { extRes = krfSolMsg; } if (__SimpleAnalizerB__) { return(true); } if (!pAnMan.SnapSaveGP(false)) { return(true); } } } } } } return(false); }
public bool ExtFishSub(int sz, int no, int FMSize, int BaseSel, int CoverSel, bool FinnedF, bool _Fdef = true) { int noB = (1 << no); bool extFlag = (sz >= 3 && ((BaseSel | CoverSel).BitCount() > 18)); if (_Fdef) { FMan = new FishMan(this, FMSize, no, sz, extFlag); } foreach (var Bas in FMan.IEGet_BaseSet(BaseSel, FinnedF:FinnedF)) //select BaseSet { if (pAnMan.CheckTimeOut()) { return(false); } foreach (var Cov in FMan.IEGet_CoverSet(Bas, CoverSel, FinnedF)) //select CoverSet { Bit81 FinB81 = Cov.FinB81; Bit81 ELM = null; var FinZeroB = FinB81.IsZero(); if (!FinnedF && FinZeroB) //===== no Fin ===== { if (!FinnedF && (ELM = Cov.CoverB81 - Bas.BaseB81).Count > 0) { foreach (var P in ELM.IEGetUCeNoB(pBDL, noB)) { P.CancelB = noB; SolCode = 2; } if (SolCode > 0) //solved!( { if (SolInfoB) { _Fish_FishResult(no, sz, Bas, Cov, (FMSize == 27)); //FMSize 18:regular 27:Franken/Mutant } if (__SimpleAnalizerB__) { return(true); } if (!pAnMan.SnapSaveGP(true)) { return(true); } } } } else if (FinnedF && !FinZeroB) //===== Finned ===== { Bit81 Ecand = Cov.CoverB81 - Bas.BaseB81; ELM = new Bit81(); foreach (var P in Ecand.IEGetUCeNoB(pBDL, noB)) { if ((FinB81 - ConnectedCells[P.rc]).Count == 0) { ELM.BPSet(P.rc); } } if (ELM.Count > 0) //there are cells/digits can be excluded { foreach (var P in ELM.IEGet_rc().Select(p => pBDL[p])) { P.CancelB = noB; SolCode = 2; } if (SolCode > 0) //solved! { if (SolInfoB) { _Fish_FishResult(no, sz, Bas, Cov, (FMSize == 27)); //FMSize 18:regular 27:Franken/Mutant } if (__SimpleAnalizerB__) { return(true); } if (!pAnMan.SnapSaveGP(true)) { return(true); } } } } continue; } } return(false); }
public bool CannibalisticFMFish_sub(int sz, int no, int FMSize, bool FinnedF, bool EndoF = false, bool CannF = false) { int noB = (1 << no); int BaseSel = 0x7FFFFFF, CoverSel = 0x7FFFFFF; FishMan FMan = new FishMan(this, FMSize, no, sz, (sz >= 3)); foreach (var Bas in FMan.IEGet_BaseSet(BaseSel, FinnedF:FinnedF, EndoFlg:EndoF)) //BaseSet { foreach (var Cov in FMan.IEGet_CoverSet(Bas, CoverSel, CannF)) //CoverSet { if (pAnMan.CheckTimeOut()) { return(false); } Bit81 FinB81 = Bas.BaseB81 - Cov.CoverB81; if (FinB81.Count == 0) { foreach (var P in Cov.CannFin.IEGetUCeNoB(pBDL, noB)) { P.CancelB = noB; SolCode = 2; } if (SolCode > 0) { if (SolInfoB) { _Fish_FishResult(no, sz, Bas, Cov, (FMSize == 27)); //FMSize 27:Franken/Mutant } //WriteLine(ResultLong); //___Debug_CannFish("Cannibalistic"); if (__SimpleAnalizerB__) { return(true); } if (!pAnMan.SnapSaveGP(true)) { return(true); } } } else { FinB81 |= Cov.CannFin; Bit81 ELM = null; Bit81 E = (Cov.CoverB81 - Bas.BaseB81) | Cov.CannFin; ELM = new Bit81(); foreach (var rc in E.IEGet_rc()) { if ((FinB81 - ConnectedCells[rc]).Count == 0) { ELM.BPSet(rc); } } if (ELM.Count > 0) { foreach (var P in ELM.IEGetUCeNoB(pBDL, noB)) { P.CancelB = noB; SolCode = 2; } if (SolCode > 0) { if (SolInfoB) { _Fish_FishResult(no, sz, Bas, Cov, (FMSize == 27)); } //WriteLine(ResultLong); //___Debug_CannFish("Finned Cannibalistic"); if (__SimpleAnalizerB__) { return(true); } if (!pAnMan.SnapSaveGP(true)) { return(true); } } } } } } return(false); }