Example #1
0
        public RefrigtzW.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;
                RefrigtzW.AllDraw Dummy      = null;
                BinaryFormatter   Formatters = new BinaryFormatter();
                DummyFileStream.Seek(0, SeekOrigin.Begin);

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

                return(Dummy);
            }
        }
Example #2
0
        public bool Save(bool FOUND, bool Quantum, FormRefrigtz 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)
            {
                try
                {
                    RefrigtzW.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(FormRefrigtz.OrderPlate);
                                RefrigtzW.AllDraw.DrawTable = false;
                            }
                        }
                    }
                    else
                    if (File.Exists(AllDrawKindString))
                    {
                        File.Delete(FormRefrigtz.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(FormRefrigtz.OrderPlate);
                            RefrigtzW.AllDraw.DrawTable = false;
                        }
                    }
                    Curent.Draw = Stote;
                    return(true);

#pragma warning disable CS0162 // Unreachable code detected
                    return(true);

#pragma warning restore CS0162 // Unreachable code detected
                }
                catch (Exception t)
                {
                    Log(t);
                    return(false);
                }
            }
        }
Example #3
0
        public bool Load(bool FOUND, bool Quantum, FormRefrigtz 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(FormRefrigtz.AllDrawKindString))
                    {
                        if (FormRefrigtz.MovmentsNumber >= 0)
                        {
                            //if (!Quantum)
                            {
                                GalleryStudio.RefregizMemmory tr = new GalleryStudio.RefregizMemmory(MovementsAStarGreedyHeuristicFound, IInoreSelfObjects, UsePenaltyRegardMechnisam, BestMovments, PredictHeuristic, OnlySelf, AStarGreedyHeuristic, ArrangmentsChanged);
                                t = (RefrigtzW.AllDraw)tr.Load(Quantum, FormRefrigtz.OrderPlate);
                                if (t != null)
                                {
                                    Curent.Draw = t;
                                    LoadTree    = true;
                                    Curent.Draw = Curent.RootFound();
                                    Curent.Draw.UpdateLoseAndWinDepenOfKind(FormRefrigtz.OrderPlate);

                                    t = Curent.Draw;

                                    DrawDrawen = true;
                                }
                            }
                        }
                        File.Delete(FormRefrigtz.AllDrawKindString);
                    }
                }
                catch (Exception t) { Log(t); }



                return(DrawDrawen);
            }
        }
Example #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;
                RefrigtzW.AllDraw Current = new RefrigtzW.AllDraw(Order, MovementsAStarGreedyHeuristicFoundT, IgnoreSelfObjectsT, UsePenaltyRegardMechnisamT, BestMovmentsT, PredictHeuristicT, OnlySelfT, AStarGreedyHeuristicT, ArrangmentsT);
            }
        }
Example #5
0
        public RefrigtzW.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);
                    }

                    RefrigtzW.AllDraw tt = new RefrigtzW.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 = (RefrigtzW.AllDraw)Formatters.Deserialize(DummyFileStream);
                    if (tt == null)
                    {
                        return(tt);
                    }
                    tt = (RefrigtzW.AllDraw)tt.LoaderEC(Quantum, Order, DummyFileStream, Formatters);

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

                    return(tt);
                }

                return(null);

                //return Node.al;
            }
        }