Пример #1
0
        public bool Load(bool FOUND, bool Quantum, ChessForm Curent, ref bool LoadTree, bool MovementsAStarGreedyHeuristicFound, bool IInoreSelfObjects, bool UsePenaltyRegardMechnisam, bool BestMovments, bool PredictHeuristic, bool OnlySelf, bool AStarGreedyHeuristic, bool ArrangmentsChanged)
        {
            Object OO = new Object();

            lock (OO)
            {
                DrawManagement(FOUND, UsePenaltyRegardMechnisam, AStarGreedyHeuristic);
                bool DrawDrawen = false;
                //Load Middle Targets.
                try
                {
                    if (File.Exists(ChessForm.AllDrawKindString))
                    {
                        if (ChessForm.MovmentsNumber >= 0)
                        {
                            //if (!Quantum)
                            {
                                GalleryStudio.RefregizMemmory tr = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHeuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHeuristic, OnlySelf, AStarGreedyHeuristic, ArrangmentsChanged);
                                t = (RefrigtzDLL.AllDraw)tr.Load(Quantum, ChessForm.OrderPlate);
                                if (t != null)
                                {
                                    Curent.Draw = t;
                                    LoadTree    = true;
                                    Curent.Draw = Curent.RootFound();
                                    //Curent.Draw.UpdateLoseAndWinDepenOfKind(Curent.Draw.OrderP);

                                    t = Curent.Draw;

                                    DrawDrawen = true;
                                    System.Windows.Forms.MessageBox.Show("Load Completed.");
                                }
                            }
                        }
                        File.Delete(ChessForm.AllDrawKindString);
                    }
                }
                catch (Exception t) { Log(t); }



                return(DrawDrawen);
            }
        }
Пример #2
0
        public bool Save(bool FOUND, bool Quantum, ChessForm Curent, ref bool LoadTree, bool MovementsAStarGreedyHeuristicFound, bool IInoreSelfObjects, bool UsePenaltyRegardMechnisam, bool BestMovments, bool PredictHeuristic, bool OnlySelf, bool AStarGreedyHeuristic, bool ArrangmentsChanged)
        {
            Object OO = new Object();

            lock (OO)
            {
                object o = new object();
                lock (o)
                {
                    if (!Quantum)
                    {
                        if (!RefrigtzDLL.AllDraw.ChangedInTreeOccured)
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        if (!QuantumRefrigiz.AllDraw.ChangedInTreeOccured)
                        {
                            return(true);
                        }
                    }
                }  //System.Threading.Thread ttt = new System.Threading.Thread(new System.Threading.ThreadStart(Wait));
                   //ttt.Start();
                   //ttt.Join();

                /*if (!Quantum)
                 * {
                 *  while (Curent.Draw.AStarGreedyString != null)
                 *      Curent.Draw = Curent.Draw.AStarGreedyString;
                 * }
                 * else
                 * {
                 *  while (Curent.DrawQ.AStarGreedyString != null)
                 *      Curent.DrawQ = Curent.DrawQ.AStarGreedyString;
                 * }
                 * if (UsePenaltyRegardMechnisam && AStarGreedyHeuristic)
                 *  AllDrawKind = 4;
                 * else
                 *                                   if ((!UsePenaltyRegardMechnisam) && AStarGreedyHeuristic)
                 *  AllDrawKind = 3;
                 * if (UsePenaltyRegardMechnisam && (!AStarGreedyHeuristic))
                 *  AllDrawKind = 2;
                 * if ((!UsePenaltyRegardMechnisam) && (!AStarGreedyHeuristic))
                 *  AllDrawKind = 1;
                 * //Set Configuration To True for some unknown reason!.
                 * //UpdateConfigurationTableVal = true;
                 * SetAllDrawKindString();
                 */
                try
                {
                    RefrigtzDLL.AllDraw Stote = Curent.Draw;
                    if (!File.Exists(AllDrawKindString))
                    {
                        GalleryStudio.RefregizMemmory rt = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHeuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHeuristic, OnlySelf, AStarGreedyHeuristic, ArrangmentsChanged
                                                                                             );
                        //if (!Quantum)
                        {
                            if (Curent.Draw != null)
                            {
                                Curent.Draw             = Curent.RootFound();
                                rt.AllDrawCurrentAccess = Curent.Draw;
                                rt.RewriteAllDraw(ChessForm.OrderPlate);
                                RefrigtzDLL.AllDraw.DrawTable = false;
                                //.SetBoxText("\r\nSaved Completed.");
                                //Curent.RefreshBoxText();
                                //PictureBoxRefrigtz.SendToBack();
                                //PictureBoxTimerGray.SendToBack();
                                //PictureBoxTimerBrown.SendToBack();
                                //MessageBox.Show("Saved Completed.");
                            }
                        }

                        /*else {
                         *  if (Curent.DrawQ != null)
                         *  {
                         *      Curent.DrawQ = Curent.RootFoundQ();
                         *      rt.AllDrawCurrentAccessQ = Curent.DrawQ;
                         *      rt.RewriteAllDrawQ(ChessForm.OrderPlate);
                         *      QuantumRefrigiz.AllDraw.DrawTable = false;
                         * //Curent.SetBoxText("\r\nSaved Completed.");
                         *  //    Curent.RefreshBoxText();
                         *      //PictureBoxRefrigtz.SendToBack();
                         *      //PictureBoxTimerGray.SendToBack();
                         *      //PictureBoxTimerBrown.SendToBack();
                         *      //MessageBox.Show("Saved Completed.");
                         *  }
                         */
                    }
                    else
                    if (File.Exists(AllDrawKindString))
                    {
                        //DrawManagement(FOUND, UsePenaltyRegardMechnisam, AStarGreedyHeuristic);

                        File.Delete(ChessForm.AllDrawKindString);
                        GalleryStudio.RefregizMemmory rt = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHeuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHeuristic, OnlySelf, AStarGreedyHeuristic, ArrangmentsChanged
                                                                                             );
                        //"Universal Root Founding";
                        if (Curent.Draw != null)
                        {
                            Curent.Draw             = Curent.RootFound();
                            rt.AllDrawCurrentAccess = Curent.Draw;
                            rt.RewriteAllDraw(ChessForm.OrderPlate);
                            RefrigtzDLL.AllDraw.DrawTable = false;
                            // Curent.SetBoxText("\r\nSaved Completed.");
                            // Curent.RefreshBoxText();
                            //PictureBoxRefrigtz.SendToBack();
                            //PictureBoxTimerGray.SendToBack();
                            //PictureBoxTimerBrown.SendToBack();
                            //MessageBox.Show("Saved Completed.");
                        }
                        //DrawManagement(FOUND, UsePenaltyRegardMechnisam, AStarGreedyHeuristic);
                    }
                    Curent.Draw = Stote;
                    return(true);

                    return(true);
                }
                catch (Exception t)
                {
                    Log(t);
                    return(false);
                }
            }
        }
Пример #3
0
        public bool Save(bool FOUND, bool Quantum, ChessForm Curent, ref bool LoadTree, bool MovementsAStarGreedyHeuristicFound, bool IInoreSelfObjects, bool UsePenaltyRegardMechnisam, bool BestMovments, bool PredictHeuristic, bool OnlySelf, bool AStarGreedyHeuristic, bool ArrangmentsChanged)
        {
            Object OO = new Object();

            lock (OO)
            {
                object o = new object();
                lock (o)
                {
                    if (!Quantum)
                    {
                        if (!RefrigtzDLL.AllDraw.ChangedInTreeOccured)
                        {
                            return(true);
                        }
                    }
                }

                try
                {
                    RefrigtzDLL.AllDraw Stote = Curent.Draw;
                    if (!File.Exists(AllDrawKindString))
                    {
                        GalleryStudio.RefregizMemmory rt = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHeuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHeuristic, OnlySelf, AStarGreedyHeuristic, ArrangmentsChanged
                                                                                             );
                        //if (!Quantum)
                        {
                            if (Curent.Draw != null)
                            {
                                Curent.Draw             = Curent.RootFound();
                                rt.AllDrawCurrentAccess = Curent.Draw;
                                rt.RewriteAllDraw(ChessForm.OrderPlate);
                                RefrigtzDLL.AllDraw.DrawTable = false;
                            }
                        }
                    }
                    else
                    if (File.Exists(AllDrawKindString))
                    {
                        File.Delete(ChessForm.AllDrawKindString);
                        GalleryStudio.RefregizMemmory rt = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHeuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHeuristic, OnlySelf, AStarGreedyHeuristic, ArrangmentsChanged
                                                                                             );

                        if (Curent.Draw != null)
                        {
                            Curent.Draw             = Curent.RootFound();
                            rt.AllDrawCurrentAccess = Curent.Draw;
                            rt.RewriteAllDraw(ChessForm.OrderPlate);
                            RefrigtzDLL.AllDraw.DrawTable = false;
                        }
                    }
                    Curent.Draw = Stote;
                    return(true);

                    return(true);
                }
                catch (Exception t)
                {
                    Log(t);
                    return(false);
                }
            }
        }