Beispiel #1
0
        public RefrigtzDLL.AllDraw GetRefregiz(int No)
        {
            Object o = new Object();

            lock (o)
            {
                FileStream DummyFileStream = null;
                DummyFileStream = new FileStream(SAllDraw, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Read);
                int p = 0;
                RefrigtzDLL.AllDraw Dummy      = null;
                BinaryFormatter     Formatters = new BinaryFormatter();
                DummyFileStream.Seek(0, SeekOrigin.Begin);

                while (p <= No)
                {
                    if (DummyFileStream.Length >= DummyFileStream.Position)
                    {
                        Dummy = (RefrigtzDLL.AllDraw)Formatters.Deserialize(DummyFileStream);
                    }
                    else
                    {
                        Dummy = null;
                    }
                    p++;
                }
                DummyFileStream.Flush(); DummyFileStream.Close();

                return(Dummy);
            }
        }
Beispiel #2
0
        public bool Load(bool FOUND, bool Quantum, FormRefrigtz Curent, ref bool LoadTree, bool MovementsAStarGreedyHuristicFound, bool IInoreSelfObjects, bool UsePenaltyRegardMechnisam, bool BestMovments, bool PredictHuristic, bool OnlySelf, bool AStarGreedyHuristic, bool ArrangmentsChanged)
        {
            DrawManagement(FOUND, UsePenaltyRegardMechnisam, AStarGreedyHuristic);

            bool DrawDrawen = false;

            //Load Middle Targets.
            try
            {
                if (File.Exists(FormRefrigtz.AllDrawKindString))
                {
                    if (FormRefrigtz.MovmentsNumber >= 0)
                    {
                        if (!Quantum)
                        {
                            GalleryStudio.RefregizMemmory tr = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHuristic, OnlySelf, AStarGreedyHuristic, ArrangmentsChanged);
                            t = (RefrigtzDLL.AllDraw)tr.Load(Quantum, FormRefrigtz.OrderPlate);
                            if (t != null)
                            {
                                Curent.Draw = t;

                                LoadTree    = true;
                                Curent.Draw = Curent.RootFound();

                                t = Curent.Draw;
                                //Curent.SetDrawFounding(ref FOUND, ref THIS, false);
                                DrawDrawen = true;

                                System.Windows.Forms.MessageBox.Show("Load Completed.");
                            }
                        }
                        else
                        {
                            GalleryStudio.RefregizMemmory tr = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHuristic, OnlySelf, AStarGreedyHuristic, ArrangmentsChanged);
                            tt = (QuantumRefrigiz.AllDraw)tr.LoadQ(Quantum, FormRefrigtz.OrderPlate);
                            if (t != null)
                            {
                                Curent.DrawQ = tt;

                                LoadTree = true;


                                Curent.DrawQ = Curent.RootFoundQ();

                                tt = Curent.DrawQ;

                                DrawDrawen = true;

                                System.Windows.Forms.MessageBox.Show("Load Completed.");
                            }
                        }
                    }
                    File.Delete(FormRefrigtz.AllDrawKindString);
                }
            }
            catch (Exception t) { Log(t); }
            return(DrawDrawen);
        }
Beispiel #3
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);
            }
        }
Beispiel #4
0
        public RefregitzOperator(int Order, bool MovementsAStarGreedyHeuristicTFou, bool IgnoreSelfObject, bool UsePenaltyRegardMechnisa, bool BestMovment, bool PredictHurist, bool OnlySel, bool AStarGreedyHuris, bool Arrangments//) : base(MovementsAStarGreedyHeuristicTFou, IgnoreSelfObject, UsePenaltyRegardMechnisa, BestMovment, PredictHurist, OnlySel, AStarGreedyHuris, Arrangments
                                 )
        {
            if (UsePenaltyRegardMechnisamT && AStarGreedyHeuristicT)
            {
                AllDrawKind = 4;
            }
            else
            if ((!UsePenaltyRegardMechnisamT) && AStarGreedyHeuristicT)
            {
                AllDrawKind = 3;
            }
            if (UsePenaltyRegardMechnisamT && (!AStarGreedyHeuristicT))
            {
                AllDrawKind = 2;
            }
            if ((!UsePenaltyRegardMechnisamT) && (!AStarGreedyHeuristicT))
            {
                AllDrawKind = 1;
            }
            //Set Configuration To True for some unknown reason!.
            //UpdateConfigurationTableVal = true;
            SetAllDrawKindString();
            SAllDraw = AllDrawKindString;
            Object o = new Object();

            lock (o)
            {
                MovementsAStarGreedyHeuristicFoundT = MovementsAStarGreedyHeuristicTFou;
                IgnoreSelfObjectsT         = IgnoreSelfObject;
                UsePenaltyRegardMechnisamT = UsePenaltyRegardMechnisa;
                BestMovmentsT         = BestMovment;
                PredictHeuristicT     = PredictHurist;
                OnlySelfT             = OnlySel;
                AStarGreedyHeuristicT = AStarGreedyHuris;
                ArrangmentsT          = Arrangments;
                RefrigtzDLL.AllDraw Current = new RefrigtzDLL.AllDraw(Order, MovementsAStarGreedyHeuristicFoundT, IgnoreSelfObjectsT, UsePenaltyRegardMechnisamT, BestMovmentsT, PredictHeuristicT, OnlySelfT, AStarGreedyHeuristicT, ArrangmentsT);
            }
        }
Beispiel #5
0
        public RefrigtzDLL.AllDraw Load(bool Quantum, int Order)
        {
            Object o = new Object();

            lock (o)
            {
                if (File.Exists(SAllDraw))
                {
                    FileInfo A = new FileInfo(SAllDraw);
                    if (A.Length == 0)
                    {
                        return(null);
                    }

                    RefrigtzDLL.AllDraw tt = new RefrigtzDLL.AllDraw(Order, MovementsAStarGreedyHeuristicFoundT, IgnoreSelfObjectsT, UsePenaltyRegardMechnisamT, BestMovmentsT, PredictHeuristicT, OnlySelfT, AStarGreedyHeuristicT, ArrangmentsT);
                    FileStream          DummyFileStream = new FileStream(SAllDraw, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
                    BinaryFormatter     Formatters      = new BinaryFormatter();
                    DummyFileStream.Seek(0, SeekOrigin.Begin);

                    //Console.WriteLine("Loading...");
                    tt = (RefrigtzDLL.AllDraw)Formatters.Deserialize(DummyFileStream);
                    if (tt == null)
                    {
                        return(tt);
                    }
                    tt = (RefrigtzDLL.AllDraw)tt.LoaderEC(Quantum, Order, DummyFileStream, Formatters);

                    DummyFileStream.Flush();
                    DummyFileStream.Close();

                    return(tt);
                }

                return(null);

                //return Node.al;
            }
        }
Beispiel #6
0
        public RefrigtzDLL.AllDraw Load(bool Quantum, int Order)
        {
            Object o = new Object();

            lock (o)
            {
                RefrigtzDLL.AllDraw tt = null;
                FileStream          DummyFileStream = new FileStream(SAllDraw, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
                BinaryFormatter     Formatters      = new BinaryFormatter();
                DummyFileStream.Seek(0, SeekOrigin.Begin);

                Console.WriteLine("Loading...");
                tt = (RefrigtzDLL.AllDraw)Formatters.Deserialize(DummyFileStream);

                tt = tt.LoadrEC(Quantum, Order, DummyFileStream, Formatters);

                DummyFileStream.Flush();
                DummyFileStream.Close();

                return(tt);

                //return Node.al;
            }
        }
Beispiel #7
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);
                }
            }
        }
Beispiel #8
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);
                }
            }
        }