Ejemplo n.º 1
0
 public void Add(object a, EventArgs e)
 {
     if (this.Nodes.Count <= 1)
     {
         NN fx = new NN();
         fx.ShowDialog();
         this.Nodes.Add(new Nod(fx.name, false));
         this.Expand();
     }
     else
     {
         MessageBox.Show("Дерево бинарное!");
     }
 }
Ejemplo n.º 2
0
 public void Ren(object a, EventArgs e)
 {
     if (this.Nodes.Count <= 1)
     {
         NN fx = new NN();
         fx.ShowDialog();
         this.Text = fx.name;
         this.Expand();
     }
     else
     {
         MessageBox.Show("Дерево бинарное!");
     }
 }
Ejemplo n.º 3
0
        private void InitializeMap(Point startLocation)
        {
            clearMap();
            //  □ □ □ □ □ □ □
            //  □ □ □ □ □ □ □
            //  □ S □ □ □ F □
            //  □ □ □ □ □ □ □
            //  □ □ □ □ □ □ □

            this.map = new bool[14, 14];
            for (int y = 0; y < 14; y++)
            {
                for (int x = 0; x < 14; x++)
                {
                    map[x, y] = true;
                }
            }



            //var startLocation = new Point(1, 1);
            //var endLocation = new Point(9, 9);
            //for(int i=0; i<2; i++)
            //{

            Point endLocation = startLocation;
            int   indeks      = (osobnik.random.Next(WayPoints.Count()));

            endLocation = WayPoints.ElementAt(indeks);


            this.searchParameters = new SearchParameters(startLocation, endLocation, map);
            //startLocation = endLocation;
            Form1.startpoint.Equals(endLocation);

            WayPoints.RemoveAt(indeks);
            Thing Diamond = new Thing();

            System.Threading.Thread.Sleep(200);

            /*andom rshape = new Random();
            *  Random rcolor = new Random();
            *  Random rweight = new Random();
            *  Random rsize = new Random();*/

            /*hape.Next(0, 1);
             * rcolor.Next(0, 3);
             * rweight.Next(0, 5);
             * rsize.Next(0, 2);*/
            int rshape = osobnik.random.Next(2);

            if (rshape.Equals(0))
            {
                Diamond.SetShape("Nieostry");
            }
            else
            {
                Diamond.SetShape("Ostry");
            }


            int rcolor = osobnik.random.Next(4);

            if (rcolor.Equals(0))
            {
                Diamond.SetColor("Biały");
            }
            else if (rcolor.Equals(1))
            {
                Diamond.SetColor("Niebieski");
            }
            else if (rcolor.Equals(2))
            {
                Diamond.SetColor("Czerwony");
            }
            else if (rcolor.Equals(3))
            {
                Diamond.SetColor("Zielony");
            }


            int rweight = osobnik.random.Next(6);

            if (rweight.Equals(0))
            {
                Diamond.SetWeight("10g");
            }
            else if (rweight.Equals(1))
            {
                Diamond.SetWeight("20g");
            }
            else if (rweight.Equals(2))
            {
                Diamond.SetWeight("30g");
            }
            else if (rweight.Equals(3))
            {
                Diamond.SetWeight("40g");
            }
            else if (rweight.Equals(4))
            {
                Diamond.SetWeight("50g");
            }
            else if (rweight.Equals(5))
            {
                Diamond.SetWeight("60g");
            }



            int rsize = osobnik.random.Next(3);

            if (rsize.Equals(0))
            {
                Diamond.SetSize("maly");
            }
            else if (rsize.Equals(1))
            {
                Diamond.SetSize("sredni");
            }
            else if (rsize.Equals(2))
            {
                Diamond.SetSize("duzy");
            }

            //////////    Diament z atrybutami

            Form1.text.AppendText("(" + Diamond.GetColor() + Diamond.GetShape() + Diamond.GetSize() + Diamond.GetWeight() + ")\n\r");

            if (Diamond.GetShape() == "Nieostry" && Diamond.GetSize() == "maly")
            {
                CEApattern = true;
            }
            else
            {
                CEApattern = false;
            }
            if (Diamond.GetShape() == "Nieostry" && (Diamond.GetSize() == "maly" || Diamond.GetSize() == "sredni"))
            {
                DTpattern = true;
            }
            else
            {
                DTpattern = false;
            }


            Form1.text.AppendText("Decyzja CEA : " + CEApattern + "\r\n" + "Decyzja DT : " + DTpattern + "\r\n");
            Form1.text.AppendText(NN.Verdict(CEApattern, DTpattern));


            /*if (WayPoints.Count() > 8)
             * {
             *  //clearMap();
             *  InitializeMap(startLocation);
             *
             * }
             * else
             * {
             *
             * }*/


            // }
        }