public void _SDK_Ctrl_Initialize()
        {
            AnalyzerMode = "Solve";
            GNPX_Eng.pGP.Sol_ResultLong = "";
            UPuzzle pGP = GetCurrentProble();

            GNPX_Eng.SetGP(pGP);

            GNPX_Eng.AnalyzerCounterReset( );
            GNPX_Eng.AnMan.ResetAnalysisResult(true);   //Return to initial state
            GNPX_Eng.AnMan.Set_CellFreeB();
            SDK_Ctrl.UGPMan     = null;                 //initialize Multi_solver
            GNPX_Eng.pGP.extRes = "";
        }
Example #2
0
        //====================================================================================
        public void SDK_ProblemMakerReal(CancellationToken ct)    //Creating problems[Automatic]
        {
            try{
                int mlt = MltProblem;
                pGNPX_Eng.Set_MethodLst_Run();

                do
                {
                    if (ct.IsCancellationRequested)
                    {
                        ct.ThrowIfCancellationRequested(); return;
                    }

                    LoopCC++; TLoopCC++;
                    List <UCell> BDL = GeneratePuzzleCandidate( );   //Problem candidate generation
                    UPuzzle      P   = new UPuzzle(BDL);
                    pGNPX_Eng.SetGP(P);

                    pGNPX_Eng.AnalyzerCounterReset();
                    pGNPX_Eng.sudokAnalyzerAuto(ct);

                    if (GNPZ_Engin.retCode == 0)
                    {
#if DEBUG
                        __ret000 = true;  //##########
#endif
                        string prbMessage;
                        int    DifLevel = pGNPX_Eng.GetDifficultyLevel(out prbMessage);
                        if (DifLevel < lvlLow || lvlHgh < DifLevel)
                        {
                            continue;                                      //Difficulty check
                        }
#if DEBUG
                        __ret001 = true;  //##########
#endif
                        P.DifLevel   = DifLevel;
                        P.Name       = prbMessage;
                        P.TimeStamp  = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                        P.solMessage = pGNPX_Eng.DGViewMethodCounterToString();
                        pGNP00.SDK_ProblemListSet(P);

                        SDKEventArgs se = new SDKEventArgs(ProgressPer: (--mlt));
                        Send_Progress(this, se);  //(can send information in the same way as LoopCC.)
                        if (CbxNextLSpattern)
                        {
                            rxCTRL = 0;                //Change LS pattern at next problem generation
                        }
                    }
                }while(mlt > 0);
            }
            catch (TaskCanceledException) { WriteLine("...Canceled by user."); }
            catch (Exception ex) { WriteLine(ex.Message + "\r" + ex.StackTrace); }
        }