예제 #1
0
        public async Task decalAr(Fleche flecheFin, Canvas c)//Décaler une fléche en arrière
        {
            int             i = 0;
            DoubleAnimation dx, dy;

            this.bout.masquer(c);//masquage du bout
            for (i = nbLines - 1; i >= flecheFin.nbLines + 1; i--)
            {
                c.Children.Remove(l[i]);
                l[i].X2 = l[i].X1;
                l[i].Y2 = l[i].Y1;
                dx      = new DoubleAnimation(l[i].X2 - height[i], TimeSpan.FromSeconds(Temps.time / (nbLines - flecheFin.nbLines)));
                dy      = new DoubleAnimation(l[i].Y2 - width[i], TimeSpan.FromSeconds(1));
                l[i].BeginAnimation(Line.X2Property, dx); //début de l'animation
                l[i].BeginAnimation(Line.Y2Property, dy); //début de l'animation
                await Task.Delay(TimeSpan.FromSeconds(0.1));
            }
            i--;
            if (this.typefleche == 9 && flecheFin.typefleche == 3)
            {
                dx = new DoubleAnimation(l[i].X2 - ((height[i]) / 3), TimeSpan.FromSeconds(Temps.time / (nbLines - flecheFin.nbLines)));
            }
            else
            {
                dx = new DoubleAnimation(l[i].X2 - height[i], TimeSpan.FromSeconds(Temps.time / (nbLines - flecheFin.nbLines)));
            }

            dy = new DoubleAnimation(l[i].Y2 - width[i], TimeSpan.FromSeconds(1));
            l[i].BeginAnimation(Line.X2Property, dx); //début de l'animation
            l[i].BeginAnimation(Line.Y2Property, dy); //début de l'animation
            await Task.Delay(TimeSpan.FromSeconds(0.2));

            flecheFin.dessiner(0.1, c);//dessiner la fléche de fin
            this.retirerCanvas(c);
        }
예제 #2
0
 public Maillon(int val, double coordx, double coordy, double height, double width, SolidColorBrush couleurFond, SolidColorBrush couleurBordure, double epaisseurBord, int typefleche, int typebout, double tailleFleche)
 //Constructeur de maillon qui initialise tout ces attributs
 {
     champ = new Rectangle();       // création d'un rectangle
     Canvas.SetLeft(champ, coordx); //positionnement du rectangle
     Canvas.SetTop(champ, coordy);
     cas                   = new Case(val, coordx, coordy, 1, height, width - (width / 5), Brushes.White, couleurBordure, epaisseurBord);
     adr                   = new Fleche(coordx + width - 5, coordy + (height / 2), Brushes.Black, tailleFleche, typefleche, typebout);
     champ.Width           = width;       //initialisation de la taille
     champ.Height          = height;
     champ.Fill            = couleurFond; //initialisation du fond
     champ.Stroke          = couleurBordure;
     champ.StrokeThickness = epaisseurBord;
     this.champ.RadiusX    = 5;//initialisation du degré de courbure
     this.champ.RadiusY    = 5;
 }
예제 #3
0
        public async Task recherche_seq(int val, int[] tabInfo, Canvas c, Boolean insSup, Commentaire comPrincipal, Canvas Algo)
        {
            //recherche de la valeur val et returne indice qui se trouve dans tabInfo
            int i = 0;

            tabInfo[0] = 0;
            Algo            algo            = new Algo(15, coordX_Algo, coordY_Algo); //Création d'un algorithme de déroulement
            SolidColorBrush couleurparcours = Brushes.Red;
            SolidColorBrush couleurtrouve   = Brushes.Green;
            Commentaire     com             = new Commentaire(" ", Brushes.Black, this.coordX - 5, this.coordY - 35, 50, 50, couleurparcours, couleurparcours);

            comPrincipal.CouleurFond    = Brushes.Yellow;
            comPrincipal.CouleurBordure = Brushes.Black;
            comPrincipal.apparaitre(1);                          //Apparaitre le commentaire principale
            comPrincipal.Text = "Recherche en cours ...";
            algo.afficher(Algo);                                 //Affichage de l'algorithme
            await algo.colorer(couleurAlgo, 0, 0.5 *Temps.time); //Déroulement de l'algorithme

            await algo.colorer(couleurAlgo, 1, 0.5 *Temps.time);

            await algo.colorer(couleurAlgo, 2, 0.5 *Temps.time);

            await algo.colorer(couleurAlgo, 3, 0.5 *Temps.time);

            com.ajouterCanvas(c);
            com.disparaitre(0);
            com.opacity = 0;
            com.Height  = 30;
            com.Width   = 160;
            Fleche parcours = new Fleche(1);//Création de la fléche de parcourt

            parcours.Height      = tailleFleche;
            parcours.StrokeThick = 3;
            parcours.Color       = couleurparcours;
            parcours.L.Opacity   = 0.9;
            parcours.CoordY      = this.coordY + widthOfmaillon / 2;
            if (this.triee == false)                           //Si la liste n'est pas triée
            {
                while (i < this.list.Count && tabInfo[0] == 0) //Si on est pas arriver à la fin de la liste
                {
                    await algo.colorer(couleurAlgo, 4, 0.5 *Temps.time);

                    this.list[i].opacity = 0.7;
                    if (this.list[i].Valeur != val)//Si la valeur du maillon est différente de la valeur rechercher
                    {
                        com.CoordX = this.list[i].CoordX;
                        com.CoordY = this.list[i].CoordY - 35;
                        this.list[i].colorMaillon(couleurparcours, couleurBordureMaillon, 2);//On colorie en gris le maillon
                        this.list[i].colorCase(couleurparcours, couleurBordureMaillon, 2);
                        com.Text = "  " + this.list[i].Valeur + " est différent de " + val;
                        com.apparaitre(Temps.time);//On affiche le commantaire que la valeur du maillon est différente de la valeur rechercher
                        await algo.colorer(couleurAlgo, 7, 0.5 *Temps.time);

                        parcours.CoordX = list[i].Adr.CoordX;//On passe au coordonnée de la fléche du maillon suivant
                        parcours.bout   = new Bout(list[i].Adr.bout.coordX, list[i].Adr.bout.coordY, couleurparcours, list[i].Adr.bout.TypeBout, 2.5);
                        if (i < list.Count - 1)
                        {
                            await parcours.dessiner(Temps.time, c);                   //On dessine la fléche du partcourt
                        }
                        await algo.colorer(couleurAlgo, 8, Temps.time);

                        parcours.retirerCanvas(c);
                        com.disparaitre(0);
                        this.list[i].colorMaillon(couleurFondMaillon, couleurBordureMaillon, 2); tabInfo[1] = tabInfo[1] + 1;
                        this.list[i].colorCase(couleurFondMaillon, couleurBordureMaillon, 2);
                        await algo.colorer(couleurAlgo, 9, Temps.time);
                    }
                    else//Si on a trouver la valeur
                    {
                        await algo.colorer(couleurAlgo, 5, Temps.time);

                        tabInfo[0] = 1;//Indiquer qu'on a trouvé la valeur
                        comPrincipal.disparaitre(1);
                        comPrincipal.Text           = "La valeur " + val + " a été trouvée";
                        comPrincipal.CouleurFond    = couleurtrouve;
                        comPrincipal.CouleurBordure = couleurtrouve;
                        this.list[i].opacity        = 0.7;
                        comPrincipal.apparaitre(Temps.time);
                        await algo.colorer(couleurAlgo, 6, Temps.time);

                        if (insSup == false)//Si il n'y a pas d'insertion aprés
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);
                            this.list[i].clignoter(couleurtrouve, couleurtrouve, 2, 3);
                            await Task.Delay(TimeSpan.FromSeconds(4));
                        }
                        else
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);
                        }
                        await algo.colorer(couleurAlgo, 9, 0.5 *Temps.time);
                    }
                    await algo.colorer(couleurAlgo, 10, 0.2 *Temps.time);

                    i++;
                }
                await algo.colorer(couleurAlgo, 11, 0.2 *Temps.time);
            }
            else//Si la liste est triée
            {
                parcours.CoordX = heightOfmaillon + list[i].CoordX;
                while (i < this.list.Count && tabInfo[0] == 0 && list[i].Valeur <= val)//On s'arrete si on arrive à nil ou si on trouve une valeur supérieur à la valeur rechercher
                {
                    await algo.colorer(couleurAlgo, 4, 0.5 *Temps.time);

                    this.list[i].opacity = 0.7;
                    if (this.list[i].Valeur != val)
                    {
                        com.CoordX = this.list[i].CoordX;
                        com.CoordY = this.list[i].CoordY - 35;
                        this.list[i].colorMaillon(couleurparcours, couleurBordureMaillon, 2);
                        this.list[i].colorCase(couleurparcours, couleurBordureMaillon, 2);
                        com.Text = "  " + this.list[i].Valeur + " est différent de " + val;
                        com.apparaitre(Temps.time);//faire apparaitre le commentaire
                        await algo.colorer(couleurAlgo, 7, 0.5 *Temps.time);

                        parcours.CoordX = list[i].Adr.CoordX;
                        parcours.bout   = new Bout(list[i].Adr.bout.coordX, list[i].Adr.bout.coordY, couleurparcours, list[i].Adr.bout.TypeBout, 2.5);
                        if (i < list.Count - 1)
                        {
                            await parcours.dessiner(Temps.time, c);
                        }
                        await algo.colorer(couleurAlgo, 8, Temps.time);

                        com.disparaitre(0);//faire disparaitre le commentaire
                        parcours.retirerCanvas(c);
                        this.list[i].colorMaillon(couleurFondMaillon, couleurBordureMaillon, 2); tabInfo[1] = tabInfo[1] + 1;
                        this.list[i].colorCase(couleurFondMaillon, couleurBordureMaillon, 2);
                    }
                    else//Si on trouver la valeur
                    {
                        await algo.colorer(couleurAlgo, 5, Temps.time);

                        tabInfo[0] = 1;
                        comPrincipal.disparaitre(1);
                        comPrincipal.Text           = "La valeur " + val + " a été trouvée";
                        comPrincipal.CouleurFond    = couleurtrouve;
                        comPrincipal.CouleurBordure = couleurtrouve;
                        this.list[i].opacity        = 0.7;
                        comPrincipal.apparaitre(Temps.time);
                        await algo.colorer(couleurAlgo, 6, Temps.time);

                        if (insSup == false)//si la recherche est suivie d'une insértion/suppression
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);//faire disparaitre le commentaire
                            this.list[i].clignoter(couleurtrouve, couleurtrouve, 2, 4);
                            await Task.Delay(TimeSpan.FromSeconds(4));
                        }
                        else
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);//faire disparaitre le commentaire
                        }
                        await algo.colorer(couleurAlgo, 9, 0.5 *Temps.time);
                    }
                    await algo.colorer(couleurAlgo, 10, 0.5 *Temps.time);

                    i++;
                }
                await algo.colorer(couleurAlgo, 11, 0.5 *Temps.time);
            }
            if (tabInfo[0] == 0)//Si on a pas trouvé la valeur
            {
                comPrincipal.disparaitre(2.5);
                comPrincipal.Width          = 200;
                comPrincipal.Text           = "La valeur " + val + " n'a pas été trouvée";
                comPrincipal.CouleurFond    = couleurparcours;
                comPrincipal.CouleurBordure = couleurparcours;
                comPrincipal.apparaitre(Temps.time);
                com.enleverCanvas(c);
                if (!triee)
                {
                    tabInfo[1] = tabInfo[1] - 1;
                }
            }
            comPrincipal.disparaitre(2);
            await algo.colorer(couleurAlgo, 12, Temps.time);

            algo.disparaitre(Algo);           //faire disparaitre l'algorithme déroulant
            foreach (Maillon maillon in list) //Remettre les maillons de la liste en leurs couleurs d'origine
            {
                maillon.colorMaillon(couleurFondMaillon, couleurBordureMaillon, 2);
                maillon.colorCase(couleurFondCase, couleurBordureMaillon, 2);
            }
        }
예제 #4
0
        public async Task suppression(int valeur, Canvas c, Commentaire comPrincipal, Canvas Algo)
        {
            int[]       tabInfo = new int[2]; //Le tableau qui sera modifié par la fonction de recherche
            Commentaire com     = new Commentaire(" ", Brushes.Black, this.coordX - 100, this.coordY - 70, 250, 40, Brushes.BurlyWood, Brushes.White);

            com.ajouterCanvas(c);
            com.opacity = 0;
            Algo algo = new Algo(16, coordX_Algo, coordY_Algo); //instanciation de l'algorithme déroulant

            if (this.list.Count <= 0)                           //si la liste est vide
            {
                com.Text        = "Suppression impossible, la liste est vide !";
                com.CouleurFond = Brushes.Red;
                com.Width       = 250;
                com.Height      = 50;
                com.CoordX      = this.coordX;
                com.CoordY      = this.coordY - 50;
                com.apparaitre(Temps.time);//faire apparaitre le commentaire
                await Task.Delay(TimeSpan.FromSeconds(5 * Temps.time));

                com.disparaitre(Temps.time);//faire disparaitre le commentaire
            }
            else
            {
                com.Height = 40;
                com.Width  = 250;
                com.CoordX = this.coordX;
                com.CoordY = this.coordY - 70;
                if (list.Count != 0)                                                   //si la liste n'est pas vide
                {
                    await recherche_seq(valeur, tabInfo, c, true, comPrincipal, Algo); //Il retourne un entier qui décrit l'echec (0) ou la réussite (1) de la recherche ainsi que la position
                }
                int    typefleche = -1;
                int    typebout   = -1;
                int    Tb;
                Fleche f, f2, f1, f3, f4, f5;
                if (tabInfo[0] == 0)//si la valeur n'a pas été trouvée
                {
                    await Task.Delay(TimeSpan.FromSeconds(Temps.time));

                    com.Text        = "Suppression impossible, la valeur n'existe pas dans la liste !";
                    com.CouleurFond = Brushes.Red;
                    com.Width       = 340;
                    com.apparaitre(Temps.time);//faire apparaitre le commentaire
                    await Task.Delay(TimeSpan.FromSeconds(5 * Temps.time));

                    com.disparaitre(Temps.time);//faire disparaitre le commentaire
                }
                else
                if (tabInfo[0] == 1)// si la valeur a été trouvée
                {
                    comPrincipal.Text           = "Suppression en cours ...";
                    comPrincipal.CouleurBordure = Brushes.Black;
                    comPrincipal.CouleurFond    = Brushes.Yellow;
                    comPrincipal.apparaitre(Temps.time);
                    algo.afficher(Algo);//faire apparaitre l'algorithme déroulant
                    await algo.colorer(couleurAlgo, 0, 0.3 *Temps.time);

                    await algo.colorer(couleurAlgo, 1, 0.3 *Temps.time);

                    await algo.colorer(couleurAlgo, 2, 0.3 *Temps.time);

                    await algo.colorer(couleurAlgo, 3, 0.3 *Temps.time);

                    Point[] tabl = new Point[3];
                    if ((tabInfo[1] == this.list.Count - 1) && (tabInfo[1] > 0)) //Supression d'un élément en fin de liste
                    {
                        await algo.colorer(couleurAlgo, 8, Temps.time);

                        tabl[0] = new Point(this.list[tabInfo[1]].CoordX, this.list[tabInfo[1]].CoordY); //point ou va se deplacer le maillon
                        tabl[1] = new Point(tabl[0].X, tabl[0].Y + 50);                                  //point ou va disparaitre le maillon
                        f1      = this.list[tabInfo[1] - 1].Adr;
                        f2      = this.list[tabInfo[1]].Adr;
                        f1.retirerCanvas(c);
                        com.Text           = "Le précedent du maillon à supprimer pointe son suivant ";
                        com.CouleurFond    = Brushes.LightSkyBlue;
                        com.CouleurBordure = Brushes.Black;
                        com.Width         += 80;
                        com.CoordX         = this.coordX + (tabInfo[1]) * (heightOfmaillon);
                        com.CoordY        += this.coordY + 30;
                        com.apparaitre(Temps.time);  //On adapte le commentaire au contexte
                        await Task.Delay(TimeSpan.FromSeconds(2 * Temps.time));

                        f2.retirerCanvas(c);
                        await Task.Delay(TimeSpan.FromSeconds(2 * Temps.time));

                        typefleche = 5;
                        typebout   = 1;
                        f4         = new Fleche(f1.CoordX, f1.CoordY, f2.Color, ((list.Count - 2) * (heightOfmaillon + tailleFleche + 5) + heightOfmaillon + 5), typefleche, typebout);
                        f4.dessiner(1, c);
                        await algo.colorer(couleurAlgo, 9, Temps.time);

                        this.list[tabInfo[1] - 1].Adr = f4;
                        await Task.Delay(TimeSpan.FromSeconds(2 * Temps.time));

                        this.list[tabInfo[1]].disappear(Temps.time, tabl, 2);
                        await algo.colorer(couleurAlgo, 10, Temps.time);

                        this.list.RemoveAt(this.list.Count - 1);
                        com.disparaitre(Temps.time);//faire disparaitre le commentaire
                    }
                    else
                    {
                        if ((tabInfo[1] < this.list.Count - 1) && (tabInfo[1] > 0)) //Supression d'un élément au milieu de la liste
                        {
                            await algo.colorer(couleurAlgo, 8, Temps.time);

                            tabl[0] = new Point(this.list[tabInfo[1]].CoordX, this.list[tabInfo[1]].CoordY); //On fait disparaître la case à supprimer
                            tabl[1] = new Point(tabl[0].X, tabl[0].Y + 50);
                            f1      = this.list[tabInfo[1] - 1].Adr;
                            Tb      = this.list[tabInfo[1]].Adr.bout.TypeBout;
                            f2      = this.list[tabInfo[1]].Adr;
                            f1.retirerCanvas(c);
                            await Task.Delay(TimeSpan.FromSeconds(2 * Temps.time));

                            com.Text           = "Le précedent du maillon à supprimer pointe son suivant";
                            com.CouleurFond    = Brushes.LightSkyBlue;
                            com.CouleurBordure = Brushes.Black; com.Width += 80;
                            com.CoordX         = this.coordX + tabInfo[1] * (heightOfmaillon);
                            com.CoordY        += this.coordY + 30;
                            com.apparaitre(Temps.time);//faire apparaitre le commentaire
                            f2.retirerCanvas(c);
                            await Task.Delay(TimeSpan.FromSeconds(Temps.time * 2));

                            typefleche = f2.typefleche + 2;
                            typebout   = f2.bout.TypeBout;
                            f4         = new Fleche(f1.CoordX, f1.CoordY, f1.Color, tailleFleche, typefleche, typebout);
                            f4.dessiner(1, c);
                            await algo.colorer(couleurAlgo, 9, Temps.time);

                            await Task.Delay(TimeSpan.FromSeconds(Temps.time * 2));

                            this.list[tabInfo[1]].disappear(Temps.time, tabl, 2);
                            await algo.colorer(couleurAlgo, 10, Temps.time);

                            com.disparaitre(Temps.time);//faire disparaitre le commentaire
                            await Task.Delay(TimeSpan.FromSeconds(2 * Temps.time));

                            this.list.RemoveAt(tabInfo[1]);
                            f = new Fleche(f1.CoordX, f1.CoordY, f1.Color, tailleFleche, f1.typefleche, f1.bout.TypeBout);
                            f4.decalAr(f, c);
                            this.list[tabInfo[1] - 1].Adr = f;
                        }
                        else    //Supression d'un élément en debut de liste
                        {
                            await algo.colorer(couleurAlgo, 4, Temps.time);

                            tabl[0] = new Point(this.list[tabInfo[1]].CoordX, this.list[tabInfo[1]].CoordY); //On fait disparaître la case à supprimer
                            tabl[1] = new Point(tabl[0].X, tabl[0].Y + 50);
                            f1      = this.list[list.Count - 1].Adr;
                            f2      = this.list[tabInfo[1]].Adr;
                            f1.retirerCanvas(c);
                            await Task.Delay(TimeSpan.FromSeconds(Temps.time));

                            f2.retirerCanvas(c);
                            com.Text           = "Le précedent du maillon à supprimer pointe son suivant";
                            com.CouleurFond    = Brushes.LightSkyBlue;
                            com.CouleurBordure = Brushes.Black;
                            com.Width         += 80;
                            com.CoordX         = this.coordX + tabInfo[1] * (heightOfmaillon);
                            com.CoordY        += this.coordY + 30;
                            com.apparaitre(Temps.time);//faire apparaitre le commentaire
                            await Task.Delay(TimeSpan.FromSeconds(2 * Temps.time));

                            this.list[tabInfo[1]].disappear(Temps.time, tabl, 2);
                            await algo.colorer(couleurAlgo, 5, Temps.time);

                            await Task.Delay(TimeSpan.FromSeconds(2 * Temps.time));

                            this.list.RemoveAt(tabInfo[1]);
                        }
                        Point[] tabPoint = new Point[1];
                        for (int i = tabInfo[1]; i < list.Count; i++)      //Décalages
                        {
                            tabPoint[0] = new Point((i) * (heightOfmaillon + tailleFleche + 5) + 10, this.coordY);
                            tabPoint[0] = new Point(this.coordX + ((i) * (heightOfmaillon + tailleFleche + 5)), this.coordY);
                            list[i].Adr.decaler(this.coordX + ((i) * (heightOfmaillon + tailleFleche + 5)) + heightOfmaillon - 5, this.coordX + ((i) * (heightOfmaillon + tailleFleche + 5)) + heightOfmaillon + tailleFleche - 5); // (i + 1) * (heightOfmaillon + tailleFleche + 5), time);
                            list[i].deplacer(tabPoint, 1);                                                                                                                                                                          //deplacer le maillon
                        }
                        if (list.Count >= 1)                                                                                                                                                                                        //si la liste n'est pas vide
                        {
                            f3 = list[list.Count - 1].Adr;
                            f3.retirerCanvas(c);

                            await Task.Delay(TimeSpan.FromSeconds(Temps.time));

                            f5 = new Fleche(this.coordX + ((list.Count - 1) * (heightOfmaillon + tailleFleche + 5)) + heightOfmaillon - 5, f3.CoordY, f3.Color, (list.Count - 1) * (heightOfmaillon + tailleFleche + 5) + heightOfmaillon + 5, 5, 1);
                            f5.dessiner(1, c);
                            await algo.colorer(couleurAlgo, 6, 0.5 *Temps.time);

                            await algo.colorer(couleurAlgo, 7, 0.5 *Temps.time);

                            list[list.Count - 1].Adr = f5;
                        }
                        await algo.colorer(couleurAlgo, 11, 0.3 *Temps.time);

                        if (tabInfo[1] == 0)
                        {
                            com.disparaitre(Temps.time);//faire disparaitre le commentaire
                        }
                        for (int i = tabInfo[1]; i < list.Count - 1; i++)
                        {
                            list[i].Adr.CoordX = (this.coordX + ((i) * (heightOfmaillon + tailleFleche + 5)) + heightOfmaillon - 5);
                        }
                        comPrincipal.disparaitre(Temps.time); //faire disparaitre le commentaire
                    }
                    algo.disparaitre(Algo);                   //faire disparaitre l'algorithme déroulant
                }
            }
        }
예제 #5
0
        public async Task recherche_seq_qeue(int val, int[] tabInfo, Canvas c, Boolean insSup, Commentaire comPrincipal, Canvas Alg)
        {
            //recherche de la valeur val et returne indice qui se trouve dans tabInfo
            int i = list.Count - 1;

            tabInfo[0] = 0;
            Algo            algo            = new Algo(12, coordX_Algo, coordY_Algo); //Création d'un algorithme de déroulement
            SolidColorBrush couleurparcours = Brushes.Red;
            SolidColorBrush couleurtrouve   = Brushes.Green;
            Commentaire     com             = new Commentaire(" ", Brushes.Black, this.coordX - 5, this.coordY - 35, 50, 50, couleurparcours, couleurparcours);

            comPrincipal.CouleurFond    = Brushes.Yellow;
            comPrincipal.CouleurBordure = Brushes.Black;
            comPrincipal.apparaitre(1);
            comPrincipal.Text = "Recherche en cours ...";
            algo.afficher(Alg);                                  //Affichage de l'algorithme
            await algo.colorer(couleurAlgo, 0, 0.5 *Temps.time); //Déroulement de l'algorithme

            await algo.colorer(couleurAlgo, 1, 0.5 *Temps.time);

            await algo.colorer(couleurAlgo, 2, 0.5 *Temps.time);

            await algo.colorer(couleurAlgo, 3, 0.5 *Temps.time);

            com.ajouterCanvas(c);
            com.disparaitre(0);
            com.opacity = 0;
            com.Height  = 30;
            com.Width   = 160;
            Fleche parcours = new Fleche(1);

            parcours.Height      = -tailleFleche;
            parcours.StrokeThick = 3;
            parcours.Color       = couleurparcours;
            parcours.L.Opacity   = 0.9;
            parcours.CoordY      = this.coordY + 2 * widthOfmaillon / 3;
            if (this.triee == false)             //Si la liste n'est pas triée
            {
                while (i >= 0 & tabInfo[0] == 0) //Si on est pas arriver à la fin de la liste
                {
                    await algo.colorer(couleurAlgo, 4, 0.5 *Temps.time);

                    this.list[i].opacity = 0.7;
                    if (this.list[i].Valeur != val)//Si la valeur du maillon est différente de la valeur rechercher
                    {
                        com.CoordX = this.list[i].CoordX;
                        com.CoordY = this.list[i].CoordY - 35;
                        this.list[i].colorMaillon(couleurparcours, couleurBordureMaillon, 2);//On colorie en gris le maillon
                        this.list[i].colorCase(couleurparcours, couleurBordureMaillon, 2);
                        com.Text = "  " + this.list[i].Valeur + " est différent de " + val;
                        com.apparaitre(Temps.time);//On affiche le commantaire que la valeur du maillon est différente de la valeur rechercher
                        await algo.colorer(couleurAlgo, 7, 0.5 *Temps.time);

                        parcours.CoordX = list[i].Prec.CoordX;
                        parcours.bout   = new Bout(list[i].Prec.bout.coordX, list[i].Prec.bout.coordY, couleurparcours, list[i].Prec.bout.TypeBout, 2.5);
                        await parcours.dessiner(Temps.time, c);

                        await algo.colorer(couleurAlgo, 8, Temps.time);

                        parcours.retirerCanvas(c);
                        com.disparaitre(0);
                        this.list[i].colorMaillon(Brushes.Gainsboro, couleurBordureMaillon, 2); tabInfo[1] = tabInfo[1] + 1;
                        this.list[i].colorCase(Brushes.Gainsboro, couleurBordureMaillon, 2);
                    }
                    else//Si on a trouver la valeur
                    {
                        await algo.colorer(couleurAlgo, 5, Temps.time);

                        tabInfo[0] = 1;
                        comPrincipal.disparaitre(1);
                        comPrincipal.Text           = "La valeur " + val + " a été trouvée";
                        comPrincipal.CouleurFond    = couleurtrouve;
                        comPrincipal.CouleurBordure = couleurtrouve;
                        this.list[i].opacity        = 0.7;
                        comPrincipal.apparaitre(Temps.time);
                        await algo.colorer(couleurAlgo, 6, Temps.time);

                        if (insSup == false)
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);
                            // this.list[i].vibrate(4, 19);
                            this.list[i].clignoter(couleurtrouve, couleurtrouve, 2, 3);
                            await Task.Delay(TimeSpan.FromSeconds(4));
                        }
                        else
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);
                        }
                        await algo.colorer(couleurAlgo, 9, 0.5 *Temps.time);
                    }
                    i--;
                    await algo.colorer(couleurAlgo, 10, 0.2 *Temps.time);
                }
                await algo.colorer(couleurAlgo, 11, 0.2 *Temps.time);
            }
            else
            {
                parcours.CoordX = heightOfmaillon + list[i].CoordX;
                while (i >= 0 && tabInfo[0] == 0 && list[i].Valeur >= val)
                {
                    await algo.colorer(couleurAlgo, 4, 0.5 *Temps.time);

                    this.list[i].opacity = 0.7;
                    if (this.list[i].Valeur != val)
                    {
                        com.CoordX = this.list[i].CoordX;
                        com.CoordY = this.list[i].CoordY - 35;
                        this.list[i].colorMaillon(couleurparcours, couleurBordureMaillon, 2);
                        this.list[i].colorCase(couleurparcours, couleurBordureMaillon, 2);
                        com.Text = "  " + this.list[i].Valeur + " est différent de " + val;
                        com.apparaitre(Temps.time);
                        await algo.colorer(couleurAlgo, 7, 0.5 *Temps.time);

                        parcours.CoordX = list[i].Prec.CoordX;
                        parcours.bout   = new Bout(list[i].Prec.bout.coordX, list[i].Prec.bout.coordY, couleurparcours, list[i].Prec.bout.TypeBout, 2.5);
                        await parcours.dessiner(Temps.time, c);

                        await algo.colorer(couleurAlgo, 8, Temps.time);

                        parcours.retirerCanvas(c);
                        com.disparaitre(0);
                        this.list[i].colorMaillon(Brushes.Gainsboro, couleurBordureMaillon, 2); tabInfo[1] = tabInfo[1] + 1;
                        this.list[i].colorMaillon(Brushes.Gainsboro, couleurBordureMaillon, 2);
                    }
                    else//Si on trouver la valeur
                    {
                        await algo.colorer(couleurAlgo, 5, Temps.time);

                        tabInfo[0] = 1;
                        comPrincipal.disparaitre(1);
                        comPrincipal.Text           = "La valeur " + val + " a été trouvée";
                        comPrincipal.CouleurFond    = couleurtrouve;
                        comPrincipal.CouleurBordure = couleurtrouve;
                        this.list[i].opacity        = 0.7;
                        comPrincipal.apparaitre(Temps.time);
                        await algo.colorer(couleurAlgo, 6, Temps.time);

                        if (insSup == false)//si la recherche n'est pas suivie d'une insértion/suppression
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);
                            this.list[i].clignoter(couleurtrouve, couleurtrouve, 2, 3);
                            await Task.Delay(TimeSpan.FromSeconds(4));
                        }
                        else
                        {
                            this.list[i].colorMaillon(couleurtrouve, couleurtrouve, 2);
                            this.list[i].colorCase(couleurtrouve, couleurtrouve, 2);
                            com.disparaitre(0);
                        }
                        await algo.colorer(couleurAlgo, 9, 0.5 *Temps.time);
                    }
                    await algo.colorer(couleurAlgo, 10, 0.5 *Temps.time);

                    i--;
                }
                await algo.colorer(couleurAlgo, 11, 0.5 *Temps.time);
            }
            if (tabInfo[0] == 0)
            {
                comPrincipal.disparaitre(2.5);// faire disparaitre le commentaire
                comPrincipal.Text           = "La valeur " + val + " n'a pas été trouvée";
                comPrincipal.CouleurFond    = couleurparcours;
                comPrincipal.CouleurBordure = couleurparcours;
                comPrincipal.apparaitre(Temps.time);//apparition du commentaire
                com.enleverCanvas(c);
                if (!triee)
                {
                    tabInfo[1] = tabInfo[1] + 1;        //si la liste n'est pas triée
                }
            }
            comPrincipal.disparaitre(2);//faire disparaitre le commentaire
            await algo.colorer(couleurAlgo, 12, Temps.time);

            algo.disparaitre(Alg);//faire disparaitre l'algorithme déroulant
            foreach (Maillon maillon in list)
            {
                maillon.colorMaillon(couleurFondMaillon, couleurBordureMaillon, 2);
                maillon.colorCase(couleurFondCase, couleurBordureMaillon, 2);
            }
        }