Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;

            // reset
            Lres       = null;
            nbAffichee = 0;
            resetCouleurMap();
            listBox1.Items.Clear();

            // sécurité
            string[] sec = textBox1.Text.Split(',');
            int      x, y;

            if (sec.Length != 2 || !int.TryParse(sec[0], out x) && !int.TryParse(sec[1], out y))
            {
                textBox1.Text = "1,1";
            }

            sec = textBox2.Text.Split(',');
            if (sec.Length != 2 || !int.TryParse(sec[0], out x) && !int.TryParse(sec[1], out y))
            {
                textBox2.Text = "1,1";
            }

            sec = textBox3.Text.Split(',');
            if (sec.Length != 2 || !int.TryParse(sec[0], out x) && !int.TryParse(sec[1], out y))
            {
                textBox3.Text = "1,1";
            }

            // création du graph
            Graph g = new Graph();

            // path finding 1
            NodeP1 N0 = new NodeP1(textBox1.Text, textBox2.Text, map);

            Lres = g.RechercheSolutionAEtoile(N0);

            // path finding 2
            NodeP1 N1 = new NodeP1(textBox2.Text, textBox3.Text, map);

            Lres.AddRange(g.RechercheSolutionAEtoile(N1));

            if (Lres.Count == 0)
            {
                labelsolution.Text = "Pas de solution";
            }
            else
            {
                labelsolution.Text = "Une solution a été trouvée";
                foreach (GenericNode N in Lres)
                {
                    listBox1.Items.Add(N);
                }
                labelcountopen.Text   = "Nb noeuds des ouverts : " + g.CountInOpenList().ToString();
                labelcountclosed.Text = "Nb noeuds des fermés : " + g.CountInClosedList().ToString();
                g.GetSearchTree(treeView1);
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Graph g = new Graph();
            NodeTaquin N0 = new NodeTaquin(textBox1.Text);
            List<GenericNode> Lres = g.RechercheSolutionAEtoile(N0);

            if (Lres.Count == 0)
            {
                labelsolution.Text = "Pas de solution";
            }
            else
            {   labelsolution.Text = "Une solution a été trouvée";
                foreach (GenericNode N in Lres)
                {
                    listBox1.Items.Add( N);
                }
                labelcountopen.Text = "Nb noeuds des ouverts : " + g.CountInOpenList().ToString();
                labelcountclosed.Text = "Nb noeuds des fermés : "+ g.CountInClosedList().ToString();
                g.GetSearchTree( treeView1 );
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Graph              g    = new Graph();
            NodeTaquin         N0   = new NodeTaquin(textBox1.Text);
            List <GenericNode> Lres = g.RechercheSolutionAEtoile(N0);

            if (Lres.Count == 0)
            {
                labelsolution.Text = "Pas de solution";
            }
            else
            {
                labelsolution.Text = "Une solution a été trouvée";
                foreach (GenericNode N in Lres)
                {
                    listBox1.Items.Add(N);
                }
                labelcountopen.Text   = "Nb noeuds des ouverts : " + g.CountInOpenList().ToString();
                labelcountclosed.Text = "Nb noeuds des fermés : " + g.CountInClosedList().ToString();
                g.GetSearchTree(treeView1);
            }
        }
Пример #4
0
        public Information_arbre(List <GenericNode> chemin, Graph nul, Chariot chariot_choisi)
        {
            InitializeComponent();
            Affichage_Arbre_TV.Visible = true;
            Chemin_LIST.Visible        = true;

            if (chemin.Count == 0)
            {
                Ouvert_LBL.Text = " ... ";
                Fermes_LBL.Text = "...";
                Final_LBL.Text  = "Pas de solution";
            }
            else
            {
                Final_LBL.Text = "Une solution a été trouvée";
                foreach (GenericNode N in chemin)
                {
                    Chemin_LIST.Items.Add(N);
                }
                Ouvert_LBL.Text = "Nb noeuds des ouverts : " + nul.CountInOpenList().ToString();
                Fermes_LBL.Text = "Nb noeuds des fermés : " + nul.CountInClosedList().ToString();
                nul.GetSearchTree(Affichage_Arbre_TV);
            }
        }