Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            reussite = 3;

            numinitial = Convert.ToInt32(textBox1.Text);
            numfinal   = Convert.ToInt32(textBox2.Text);
            SearchTree g  = new SearchTree();
            Node2      N0 = new Node2();

            N0.numero = numinitial;
            List <GenericNode> solution = g.RechercheSolutionAEtoile(N0);


            g.GetSearchTree(treeView1);

            Correcteur c = new Correcteur();


            int resultat = c.CorrigeOuverts(L_TextBoxs_Ouverts, g.ouverts, alphabet);

            AfficheCorrectionOuverts(resultat);
            if (resultat != -1)
            {
                reussite = 0;
            }


            resultat = c.CorrigeFermes(L_TextBoxs_Fermes, g.fermes, alphabet);
            AfficheCorrectionFermes(resultat);
            if (resultat != -1)
            {
                reussite = 0;
            }
            //else {Bscore.Show() ; }
        }
Beispiel #2
0
        private bool Algorithme_AEtoile(SearchTree g)
        {
            Node2 N0 = new Node2();

            N0.numero = numinitial;
            List <GenericNode> solution = g.RechercheSolutionAEtoile2(N0);

            Node2 N1 = N0;

            for (int i = 1; i < solution.Count; i++)
            {
                Node2 N2 = (Node2)solution[i];
                listBox1.Items.Add(Convert.ToString(N1.numero)
                                   + "--->" + Convert.ToString(N2.numero)
                                   + "   : " + Convert.ToString(matrice[N1.numero, N2.numero]));
                N1 = N2;
            }

            g.GetSearchTree(treeViewCorrection);

            bool reussite = false;

            reussite = (Correction(historiqueUtiFerme, g.historiqueIAFermes) && (Correction(historiqueUtiOuvert, g.historiqueIAOuverts)));
            return(reussite);
        }
Beispiel #3
0
 //bouton qui lance la comparaison des deux arbres
 private void buttonVerif_Click(object sender, EventArgs e)
 {
     g.GetSearchTree(treeView1);
     CheckRecursive();
     if ((compteurCorrectsNodes == compteurCorrectsNodesObjectif) && (compteurCorrectsNodes != 0))
     {
         MessageBox.Show("Bien joué!");
     }
 }
Beispiel #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            numinitial = Convert.ToInt32(textBox1.Text);
            numfinal   = Convert.ToInt32(textBox2.Text);
            SearchTree g  = new SearchTree();
            Node2      N0 = new Node2();

            N0.numero = numinitial;
            List <GenericNode> solution = g.RechercheSolutionAEtoile(N0);

            Node2 N1 = N0;

            for (int i = 1; i < solution.Count; i++)
            {
                Node2 N2 = (Node2)solution[i];
                listBox1.Items.Add(Convert.ToString(N1.numero)
                                   + "--->" + Convert.ToString(N2.numero)
                                   + "   : " + Convert.ToString(matrice[N1.numero, N2.numero]));
                N1 = N2;
            }

            g.GetSearchTree(treeView1);
        }
        //Le bouton A* lance l'agorithme de recherche avant d'afficher les paramètres clés dans le form
        private void button3_Click(object sender, EventArgs e)
        {
            //paramètres
            Node Point_Initial = new Node(Convert.ToDouble(X_init.Text), Convert.ToDouble(Y_init.Text), Convert.ToChar(cbChoixVent.SelectedItem.ToString()));
            Node Point_final   = new Node(Convert.ToDouble(X_final.Text), Convert.ToDouble(Y_final.Text), Convert.ToChar(cbChoixVent.SelectedItem.ToString()));

            Node.Pf_x           = Convert.ToDouble(X_final.Text);
            Node.Pf_y           = Convert.ToDouble(Y_final.Text);
            Node.distance_Noeud = Convert.ToDouble(tBDistanceNoeud.Text);
            Node.Zone_voisinage = Convert.ToDouble(tBZoneVoisin.Text);

            listBox1.Items.Add("( " + Convert.ToString(Point_Initial.P_x) + ", " + Convert.ToString(Point_Initial.P_y) + ")");
            Point_Initial.cas = Convert.ToChar(cbChoixVent.SelectedItem.ToString());
            SearchTree g = new SearchTree();

            //Lancement de la recherche
            Point_Initial.GenericCas = Point_Initial.cas;
            List <GenericNode> solution = g.RechercheSolutionAEtoile(Point_Initial);

            MessageBox.Show(Convert.ToString(solution.Count));
            Node N1 = Point_Initial;

            for (int i = 0; i < solution.Count; i++)
            {
                Node N2 = (Node)solution[i];
                soluce.Add(N2);
                listBox1.Items.Add("( " + N2.P_x + ", " + N2.P_y + ")");
                N1 = N2;
                if (i == solution.Count - 1)
                {
                    tpsNavigation.Text = Convert.ToString(solution[i].GetGCost());
                }
            }
            g.GetSearchTree(treeView1);
            tBNfermes.Text  = Convert.ToString(g.L_Fermes.Count);
            tBNouverts.Text = Convert.ToString(g.L_Ouverts.Count);
        }