Пример #1
0
 /// <summary>
 /// Rempli le mot spécifié
 /// </summary>
 /// <param name="mot"></param>
 /// <param name="bd"></param>
 /// <param name="nbEssaisMaxPourMot"></param>
 /// <param name="afficher"></param>
 public void RemplirMot(Mot mot, Bd bd, int nbEssaisMaxPourMot, bool afficher)
 {
     listeMotsPossibles = bd.ListeMotsPossibles(mot.Contenu);
     for (int j = 0, nbMotsPossibles = listeMotsPossibles.Count; j < nbEssaisMaxPourMot && j < nbMotsPossibles; j++)
     {
         int rnd = Random.Range(0, nbMotsPossibles - 1);
         mot.EnregistrerMot(listeMotsPossibles[rnd], bd);
         if (mot.ExistentMotsTransversaux(bd))
         {
             //Debug.Log("Ai écris " + mot.Contenu);
             mot.MarquerCommeRempli(listeMotsPossibles[rnd], bd, true);
             if (afficher)
             {
                 mot.AfficherMot();
             }
             break;
         }
         else
         {
             //Debug.Log("Ai tenté d'écrire " + mot.Contenu + " mais pas de mots transversaux existants");
             mot.EffacerMot(bd);
             listeMotsPossibles.RemoveAt(rnd);
             nbMotsPossibles--;
         }
     }
 }
Пример #2
0
    /// <summary>
    /// Retourne au hasard l'un des mots adjacents remplis
    /// </summary>
    /// <returns></returns>
    public Mot ObtenirMotAdjacentRempliAleatoire()
    {
        List <Mot> listeMotsAdjacents = new List <Mot>();

        foreach (Lettre lettre in listeLettres)
        {
            Mot motTransversal = lettre.ObtenirMotDansDirection(!horizontal);
            if (motTransversal != null)
            {
                foreach (Lettre lettreTransversale in motTransversal.listeLettres)
                {
                    Mot motAdjacent = lettreTransversale.ObtenirMotDansDirection(horizontal);
                    if (motAdjacent != null && motAdjacent.Rempli)
                    {
                        listeMotsAdjacents.Add(motAdjacent);
                    }
                }
            }
        }
        if (listeMotsAdjacents.Count != 0)
        {
            return(listeMotsAdjacents[Random.Range(0, listeMotsAdjacents.Count)]);
        }
        else
        {
            return(null);
        }
    }
Пример #3
0
        private void ValideFichierRef(ColConfWin.IllRule illRuleToUse)
        {
            bool success = true;

            if (File.Exists(fullName))
            {
                using (TextFieldParser csvParser = new TextFieldParser(fullName))
                {
                    csvParser.SetDelimiters(new string[] { ";" });
                    csvParser.HasFieldsEnclosedInQuotes = false;

                    // Skip the row with the column names
                    string headerLine = csvParser.ReadLine();
                    while (!csvParser.EndOfData)
                    {
                        // Read current line fields, pointer moves to the next line.
                        Mot m = new Mot(csvParser.ReadFields());
                    }
                    Config conf = new Config();
                    conf.colors[PhonConfType.phonemes].IllRuleToUse = illRuleToUse;

                    Mot.EnsureCompleteness(conf, true);

                    foreach (Mot m in Mot.mots)
                    {
                        if (!(m.matchSet && m.match))
                        {
                            success = false;
                            Console.WriteLine(m.GetFileString());
                        }
                    }
                }
            }
            Assert.IsTrue(success);
        }
        public static void Processor(bool json)
        {
            Console.Title = "MOT Converter";
            Program.Choose(1, "bin", out string[] fileNames);
            if (fileNames.Length < 1)
            {
                return;
            }

            string filepath, ext;
            Mot    mot;

            foreach (string file in fileNames)
            {
                mot      = new Mot();
                ext      = Path.GetExtension(file);
                filepath = file.Replace(ext, "");
                ext      = ext.ToLower();

                Console.Title = "MOT Converter: " + Path.GetFileNameWithoutExtension(file);
                if (ext == ".bin")
                {
                    mot.MOTReader(filepath);
                    mot.MsgPackWriter(filepath, json);
                }
                else if (ext == ".mp" || ext == ".json")
                {
                    mot.MsgPackReader(filepath, ext == ".json");
                    mot.MOTWriter(filepath);
                }
                mot = new Mot();
            }
        }
Пример #5
0
 /// <summary>
 /// Retire de la grille tous les transversaux d'un mot spécifié
 /// </summary>
 /// <param name="grille"></param>
 /// <param name="motCourant"></param>
 /// <param name="bd"></param>
 /// <param name="afficher"></param>
 public void RetirerMotsTransversaux(Grille grille, Mot motCourant, Bd bd, bool afficher)
 {
     foreach (Lettre lettre in motCourant.ListeLettres)
     {
         RetirerMot(lettre.ObtenirMotDansDirection(!motCourant.Horizontal), grille, bd, afficher);
     }
 }
Пример #6
0
        static void Main()
        {
            string Voyelle = "aeiouyAEIOUY";
            string Mot;
            int    NbVoyelle, i;


            // Note de version
            Console.WriteLine("****** Nombre de voyelles V1.0 , 12/07/2016 ******");
            Console.WriteLine();
            Console.WriteLine("Entrez un mot : ");
            Mot       = Console.ReadLine();
            NbVoyelle = 0;
            i         = 0;
            while (i <= Mot.Length)
            {
                if ((Voyelle.IndexOf(Mot.Substring(i, 1))) != -1)
                {
                    NbVoyelle = NbVoyelle + 1;
                }
                i++;
            }
            Console.WriteLine("il y a " + NbVoyelle + " dans " + Mot);
            Console.ReadLine();
        }
Пример #7
0
    /// <summary>
    /// Marque le mots utilisant la lettre courante dans la direction spécifiée comme rempli
    /// </summary>
    /// <param name="direction"></param>
    /// <param name="bd"></param>
    public void MarquerMotRempliDansDirection(bool direction, Bd bd)
    {
        Mot motAMarquer = ObtenirMotDansDirection(direction);

        if (motAMarquer != null)
        {
            motAMarquer.MarquerCommeRempli(bd.RechercherMotParContenu(motAMarquer.Contenu), bd, false);
        }
    }
Пример #8
0
    /// <summary>
    /// Efface la valeur de la lettre courante
    /// </summary>
    public void EffacerLettre(bool direction)
    {
        Mot motDansAutreDirection = ObtenirMotDansDirection(!direction);

        if (motDansAutreDirection == null || !motDansAutreDirection.Rempli)
        {
            valeur = ".";
        }
    }
Пример #9
0
    /// <summary>
    /// Retourne un mot transversal (ou adjacent) au mot spécifié
    /// </summary>
    /// <param name="motCourant"></param>
    /// <returns></returns>
    public Mot ObtenirMotTransversalOuAdjacentAleatoire(Mot motCourant)
    {
        Mot motARetirer = motCourant.ObtenirMotTransversalRempliAleatoire();

        if (motARetirer == null)
        {
            return(motCourant.ObtenirMotAdjacentRempliAleatoire());
        }
        return(motARetirer);
    }
Пример #10
0
 public Lettre(string valeur, int x, int y)
 {
     this.valeur        = valeur;
     this.x             = x;
     this.y             = y;
     this.motHorizontal = null;
     this.motVertical   = null;
     this.go            = null;
     this.goText        = null;
     this.goRenderer    = null;
 }
Пример #11
0
 /// <summary>
 /// Calcule les scores des mots transversaux au mot courant
 /// </summary>
 public void CalculerScoreDesMotsTransversaux()
 {
     foreach (Lettre lettre in listeLettres)
     {
         Mot motTransversal = lettre.ObtenirMotDansDirection(!this.horizontal);
         if (motTransversal != null)
         {
             motTransversal.CalculerScore();
         }
     }
 }
Пример #12
0
 public Mot(bool horizontal, int positionPrimaire)
 {
     this.listeLettres              = new List <Lettre> ();
     this.rempli                    = false;
     this.horizontal                = horizontal;
     this.taille                    = 0;
     this.precedent                 = null;
     this.suivant                   = null;
     this.positionPrimaire          = positionPrimaire;
     this.positionSecondaire        = 0;
     this.nbTentativesDeRemplissage = 0;
 }
Пример #13
0
    /// <summary>
    /// Remplir la grille
    /// </summary>
    /// <param name="bd"></param>
    /// <param name="listeMots"></param>
    /// <param name="nbEssaisMaxGlobal"></param>
    /// <param name="nbEssaisMaxPourMot"></param>
    /// <param name="afficher"></param>
    public void RemplirGrille(Bd bd, Grille grille, int nbEssaisMaxGlobal, int nbEssaisMaxPourMot, bool afficher)
    {
        int  nbEssaisGlobal = 0;
        bool trier          = false;

        CalculerScoresDesMots(grille.listeMotsARemplir);
        Mot motARemplir = ObtenirProchainMotARemplir(grille, true);

        while (motARemplir != null && nbEssaisGlobal < nbEssaisMaxGlobal)
        {
            //Debug.Log((motARemplir.Horizontal ? "Horizontal " : "Vertical ") + motARemplir.PositionPrimaire + ":" + motARemplir.PositionSecondaire);
            if (motARemplir.nbTentativesDeRemplissage == 10)
            {
                RetirerMotAleatoire(grille, motARemplir, bd, afficher);
                RetirerMotAleatoire(grille, motARemplir, bd, afficher);
            }
            else if (motARemplir.nbTentativesDeRemplissage == 20)
            {
                RetirerMotAleatoire(grille, motARemplir, bd, afficher);
                RetirerMotAleatoire(grille, motARemplir, bd, afficher);
            }
            else if (motARemplir.nbTentativesDeRemplissage == 30)
            {
                RetirerMotAleatoire(grille, motARemplir, bd, afficher);
                RetirerMotAleatoire(grille, motARemplir, bd, afficher);
            }
            else if (motARemplir.nbTentativesDeRemplissage == 40)
            {
                RetirerMotsTransversaux(grille, motARemplir, bd, afficher);
                motARemplir.nbTentativesDeRemplissage = 0;
            }
            //RemplirMotSelonScore(motARemplir, bd, nbEssaisMaxPourMot, afficher);
            RemplirMot(motARemplir, bd, nbEssaisMaxPourMot, afficher);
            motARemplir.nbTentativesDeRemplissage++;
            if (!motARemplir.Rempli)
            {
                RetirerMotAleatoire(grille, motARemplir, bd, afficher);
            }
            else
            {
                motARemplir.CalculerScoreDesMotsTransversaux();
                grille.listeMotsARemplir.Remove(motARemplir);
                trier = true;
            }
            nbEssaisGlobal++;
            motARemplir = ObtenirProchainMotARemplir(grille, trier);
        }
        if (nbEssaisGlobal == 0)
        {
            Debug.Log("Grille déjà remplie");
        }
    }
Пример #14
0
 /// <summary>
 /// Retire un mot spécifié de la grille
 /// </summary>
 /// <param name="motARetirer"></param>
 /// <param name="grille"></param>
 /// <param name="bd"></param>
 /// <param name="afficher"></param>
 public void RetirerMot(Mot motARetirer, Grille grille, Bd bd, bool afficher)
 {
     if (motARetirer != null)
     {
         motARetirer.EffacerMot(bd);
         if (afficher)
         {
             motARetirer.AfficherMot();
         }
         grille.listeMotsARemplir.Add(motARetirer);
         motARetirer.CalculerScore();
         motARetirer.CalculerScoreDesMotsTransversaux();
     }
 }
Пример #15
0
        public static H3D OpenAsH3D(Stream Input, GFPackage.Header Header)
        {
            H3D Output;

            //Model
            byte[] Buffer = new byte[Header.Entries[0].Length];

            Input.Seek(Header.Entries[0].Address, SeekOrigin.Begin);

            Input.Read(Buffer, 0, Buffer.Length);

            using (MemoryStream MS = new MemoryStream(Buffer))
            {
                Output = H3D.Open(MS);
            }

            //Skeletal Animations
            if (Header.Entries.Length > 1)
            {
                Input.Seek(Header.Entries[1].Address, SeekOrigin.Begin);

                GF1MotionPack MotPack = new GF1MotionPack(Input);

                foreach (GF1Motion Mot in MotPack)
                {
                    H3DAnimation SklAnim = Mot.ToH3DSkeletalAnimation(Output.Models[0].Skeleton);

                    SklAnim.Name = $"Motion_{Mot.Index}";

                    Output.SkeletalAnimations.Add(SklAnim);
                }
            }

            //Material Animations
            if (Header.Entries.Length > 2)
            {
                Input.Seek(Header.Entries[2].Address, SeekOrigin.Begin);

                byte[] Data = new byte[Header.Entries[2].Length];

                Input.Read(Data, 0, Data.Length);

                H3D MatAnims = H3D.Open(Data);

                Output.Merge(MatAnims);
            }

            return(Output);
        }
Пример #16
0
 public bool LettreTrouve(char c)
 {
     if (Mot.Contains(c))
     {
         for (int i = 0; i < Mot.Length; i++)
         {
             if (Mot[i] == c)
             {
                 CharDecouverts[i] = true;
             }
         }
         return(true);
     }
     return(false);
 }
Пример #17
0
        static void Main(string[] args)
        {
            using (TextFieldParser csvParser = new TextFieldParser(fullName))
            {
                csvParser.SetDelimiters(new string[] { ";" });
                csvParser.HasFieldsEnclosedInQuotes = false;

                // Skip the row with the column names
                string headerLine = csvParser.ReadLine();

                if (File.Exists(fullOutFName))
                {
                    File.Delete(fullOutFName);
                }
                using (System.IO.StreamWriter outFile = new System.IO.StreamWriter(fullOutFName))
                {
                    if (File.Exists(fullFilteredOutFN))
                    {
                        File.Delete(fullFilteredOutFN);
                    }
                    using (System.IO.StreamWriter excludedFile
                               = new System.IO.StreamWriter(fullFilteredOutFN))
                    {
                        bool recompute = args.Length > 0 && args[0] == "recompute";
                        Mot.Init();
                        while (!csvParser.EndOfData)
                        {
                            // Read current line fields, pointer moves to the next line.
                            Mot m = new Mot(csvParser.ReadFields());
                        }

                        Config conf = new Config();
                        Mot.EnsureCompleteness(conf, recompute, true);
                        Mot.DumpMotsFiltered(excludedFile, outFile);

                        if (File.Exists(fullDoublonsFN))
                        {
                            File.Delete(fullDoublonsFN);
                        }
                        using (System.IO.StreamWriter doublonFile
                                   = new System.IO.StreamWriter(fullDoublonsFN))
                        {
                            Mot.DumpDoublons(doublonFile);
                        }
                    }
                }
            }
        }
Пример #18
0
        public static H3D OpenAsH3D(Stream Input, GFPackage.Header Header, H3DDict <H3DBone> Skeleton)
        {
            H3D Output = new H3D();

            BinaryReader Reader = new BinaryReader(Input);

            int Index = 0;

            foreach (GFPackage.Entry Entry in Header.Entries)
            {
                Input.Seek(Entry.Address, SeekOrigin.Begin);

                if (Index == 20)
                {
                    break;
                }

                if (Index == 0)
                {
                    GF1MotionPack MotPack = new GF1MotionPack(Reader);

                    foreach (GF1Motion Mot in MotPack)
                    {
                        H3DAnimation Anim = Mot.ToH3DSkeletalAnimation(Skeleton);

                        Anim.Name = $"Motion_{Index++}";

                        Output.SkeletalAnimations.Add(Anim);
                    }
                }
                else
                {
                    byte[] Data = Reader.ReadBytes(Entry.Length);

                    if (Data.Length > 4 &&
                        Data[0] == 'B' &&
                        Data[1] == 'C' &&
                        Data[2] == 'H' &&
                        Data[3] == '\0')
                    {
                        Output.Merge(H3D.Open(Data));
                    }
                }
            }

            return(Output);
        }
Пример #19
0
        public FormProjetPendu(string nom, Joueur J, List <Joueur> lesJ, string provenance)
        {
            InitializeComponent();

            arrivage = provenance;
            lol      = nom;

            // Création de la liste de mots contenant tous les mots de 5 lettres
            listeMots          = new LesMots5Lettres();
            btnRejouer.Visible = false;

            // Au début, on donne un mot aléatoire de la liste de mots
            motAlea       = listeMots.donneUnMotAléatoire();
            lblPendu.Text = Convert.ToString(compteur);

            lblprenom.Text = lol;
        }
Пример #20
0
        private static string DisplayWordResult(Mot mot)
        {
            string result = "";

            for (int i = 0; i < mot.Length; i++)
            {
                if (lettresEntrees.Contains(mot.GetChar(i).ToString()))
                {
                    result += mot.GetChar(i);
                }
                else
                {
                    result += "-";
                }
            }
            return(result);
        }
Пример #21
0
 private void ClickAjouterMot(object sender, RoutedEventArgs e)
 {
     if (motTextBox.Text != "")
     {
         Mot mot = new Mot()
         {
             Chaine = motTextBox.Text
         };
         if (mot.Save())
         {
             MessageBox.Show("mot ajouté");
             motTextBox.Text = "";
         }
         else
         {
             MessageBox.Show("Erreur insertion");
         }
     }
 }
Пример #22
0
        public static H3D OpenAsH3D(Stream Input, GFPackage.Header Header, H3DDict <H3DBone> Skeleton)
        {
            H3D Output = new H3D();

            //Skeletal Animations
            Input.Seek(Header.Entries[0].Address, SeekOrigin.Begin);

            GF1MotionPack MotPack = new GF1MotionPack(Input);

            foreach (GF1Motion Mot in MotPack)
            {
                H3DAnimation SklAnim = Mot.ToH3DSkeletalAnimation(Skeleton);

                SklAnim.Name = $"Motion_{Mot.Index}";

                Output.SkeletalAnimations.Add(SklAnim);
            }

            //Material Animations
            Input.Seek(Header.Entries[1].Address, SeekOrigin.Begin);

            GFPackage.Header PackHeader = GFPackage.GetPackageHeader(Input);

            foreach (GFPackage.Entry Entry in PackHeader.Entries)
            {
                Input.Seek(Entry.Address, SeekOrigin.Begin);

                if (Entry.Length > 0)
                {
                    byte[] Data = new byte[Entry.Length];

                    Input.Read(Data, 0, Data.Length);

                    H3D MatAnims = H3D.Open(Data);

                    Output.Merge(MatAnims);
                }
            }

            return(Output);
        }
Пример #23
0
    /// <summary>
    /// Retourne au hasard l'un des mots transversux remplis
    /// </summary>
    /// <returns></returns>
    public Mot ObtenirMotTransversalRempliAleatoire()
    {
        List <Mot> listeMotsTransversaux = new List <Mot>();

        foreach (Lettre lettre in listeLettres)
        {
            Mot motTransversal = lettre.ObtenirMotDansDirection(!horizontal);
            if (motTransversal != null && motTransversal.Rempli)
            {
                listeMotsTransversaux.Add(motTransversal);
            }
        }
        if (listeMotsTransversaux.Count != 0)
        {
            return(listeMotsTransversaux[Random.Range(0, listeMotsTransversaux.Count)]);
        }
        else
        {
            return(null);
        }
    }
Пример #24
0
        public static H3D OpenAsH3D(Stream Input, GFPackage.Header Header, H3DDict <H3DBone> Skeleton = null)
        {
            BinaryReader Reader = new BinaryReader(Input);

            GFModelPack  MdlPack = new GFModelPack();
            GFMotionPack MotPack = new GFMotionPack();

            ReadModelsBG(Header.Entries[0], Reader, MdlPack); //Textures
            ReadModelsBG(Header.Entries[1], Reader, MdlPack); //Shaders
            ReadModelsBG(Header.Entries[2], Reader, MdlPack); //Models
            ReadModelsBG(Header.Entries[3], Reader, MdlPack); //Models?
            ReadModelsBG(Header.Entries[4], Reader, MdlPack); //More models
            ReadAnimsBG(Header.Entries[5], Reader, MotPack);  //Animations
            ReadAnimsBG(Header.Entries[6], Reader, MotPack);  //More animations

            H3D Output = MdlPack.ToH3D();

            foreach (GFMotion Mot in MotPack)
            {
                H3DMaterialAnim MatAnim = Mot.ToH3DMaterialAnimation();
                H3DAnimation    VisAnim = Mot.ToH3DVisibilityAnimation();

                if (MatAnim != null)
                {
                    MatAnim.Name = $"Motion_{Mot.Index}";

                    Output.MaterialAnimations.Add(MatAnim);
                }

                if (VisAnim != null)
                {
                    VisAnim.Name = $"Motion_{Mot.Index}";

                    Output.VisibilityAnimations.Add(VisAnim);
                }
            }

            return(Output);
        }
Пример #25
0
 /// <summary>
 /// Retourne vrai si le programme réussi a remplir le mot spécifié en utilisant les scores des mots du dictionnaire
 /// </summary>
 /// <param name="mot"></param>
 /// <param name="bd"></param>
 /// <param name="nbEssaisMaxPourMot"></param>
 /// <param name="afficher"></param>
 public void RemplirMotSelonScore(Mot mot, Bd bd, int nbEssaisMaxPourMot, bool afficher)
 {
     listeMotsPossibles = bd.ListeMotsPossiblesTriesParScore(mot.Contenu);
     for (int j = 0, nbMotsPossibles = listeMotsPossibles.Count; j < nbEssaisMaxPourMot && j < nbMotsPossibles; j++)
     {
         int nbEchange = 0;
         while (mot.ContenusPrecedents.Contains(listeMotsPossibles[j].contenu) && nbEchange < nbMotsPossibles)
         {
             //Debug.Log("Switch sur " + listeMotsPossibles[j].contenu);
             MotDico motPossible = listeMotsPossibles[j];
             listeMotsPossibles.RemoveAt(j);
             listeMotsPossibles.Add(motPossible);
             nbEchange++;
         }
         if (nbEchange >= nbMotsPossibles)
         {
             //Debug.Log("Clear");
             mot.ContenusPrecedents.Clear();
         }
         mot.EnregistrerMot(listeMotsPossibles[j], bd);
         if (mot.ExistentMotsTransversaux(bd))
         {
             //Debug.Log("Ai écris " + mot.Contenu);
             mot.MarquerCommeRempli(listeMotsPossibles[j], bd, true);
             if (afficher)
             {
                 mot.AfficherMot();
             }
             break;
         }
         else
         {
             //Debug.Log("Ai tenté d'écrire " + mot.Contenu + " mais pas de mots transversaux existants");
             mot.EffacerMot(bd);
         }
     }
 }
Пример #26
0
    public void iniListMots(GameObject code)
    {
        Mot m1 = new Mot();

        m1.motComplet = "Regin";
        Tuple t1 = code.transform.GetChild(0).gameObject.AddComponent <Tuple>();

        t1.key   = "C";
        t1.value = "R";
        Tuple t2 = code.transform.GetChild(1).gameObject.AddComponent <Tuple>();

        t2.key   = "V";
        t2.value = "e";
        Tuple t3 = code.transform.GetChild(2).gameObject.AddComponent <Tuple>();

        t3.key   = "C";
        t3.value = "g";
        Tuple t4 = code.transform.GetChild(3).gameObject.AddComponent <Tuple>();

        t4.key   = "V";
        t4.value = "i";
        Tuple t5 = code.transform.GetChild(4).gameObject.AddComponent <Tuple>();

        t5.key   = "C";
        t5.value = "n";
        m1.t1    = new Tuple[2] {
            t1, t2
        };
        m1.t2 = new Tuple[2] {
            t3, t4
        };
        m1.t3 = new Tuple[1] {
            t5
        };
        motchoisi = m1;
    }
Пример #27
0
        private void Instance_TriggerEvent(object sender, Mot.PdaSdk.TriggersApi.Triggers.TriggerEventArgs args)
        {
            try
            {
                Triggers.Instance.DisableEvents();

                Mot.PdaSdk.ScanAPI.Scanner.Instance.ReadLabelSync(m_ScanBuffer, 5000);

                Mot.PdaSdk.ScanAPI.ScanBuffer buff = m_ScanBuffer;
                DisposeBarcode();

                VmMdVendorFactory.Instance.Log("Hit LabelEvent");

                if (Scanned != null)
                    Scanned(this, new VmMdScannerEventArgs(buff.Label.Replace((char)0,'\r'),DateTime.Now));

                StartBarcode();
            }
            catch
            {
                DisposeBarcode();
                StartBarcode();
            }
        }
Пример #28
0
        static void Main(string[] args)
        {
            string Mot;

            do
            {
                Console.WriteLine("Joueur 1, veuillez saisir un mot français de 5 lettres minimum");
                Mot = Console.ReadLine();
            } while (Mot.Length < 5);

            // char[] MotRecherche = new char[Mot.Length]; declaration tableau classique;

            char[] MotRecherche = Mot.ToCharArray();

            Console.Clear();
            Console.WriteLine("Joueur 2 voici le mot à rechercher :");
            Jeu_tableau.MasqueLettre(ref MotRecherche);
            int  Essai = 0;
            bool gagne = false;


            do
            {
                Console.WriteLine("Veuillez choisir une lettre masquée qui compose le mot ou pas!!!");
                char lettre = char.Parse(Console.ReadLine());
                if (Jeu_tableau.Jouer(ref MotRecherche, lettre, Mot) == false)
                {
                    Essai++;
                    if ((6 - Essai) >= 0)
                    {
                        Console.WriteLine("Raté!!Il ne vous reste que : {0} coups à jouer", 6 - Essai);
                    }
                }
                else
                {
                    gagne = true;

                    Jeu_tableau.AfficherTableau(MotRecherche);

                    for (int i = 0; i < MotRecherche.Length; i++)
                    {
                        if (MotRecherche[i] == 95)
                        {
                            gagne = false;
                        }
                    }
                }
            } while (Essai <= 6 && gagne == false);

            if (gagne == true)
            {
                Console.WriteLine("Bravo vous avez gagné !! le mot est  bien :" + Mot + " avec un nombre d'erreur de :" + Essai);
                // Jeu_tableau.AfficherTableau(MotRecherche);
            }
            else
            {
                Console.WriteLine("vous avez dépasser les 6 ESSAIS, vous êtes \"pendu\" :");

                Console.WriteLine("le mot caché était: " + Mot);
            }

            Console.ReadKey();
        }
Пример #29
0
 public Dictionnaire(Mot str)
 {
     this.str = str;
 }
Пример #30
0
        private void btnRejouer_Click(object sender, EventArgs e)
        {
            btnA.Visible = true;
            btnB.Visible = true;
            btnC.Visible = true;
            btnD.Visible = true;
            btnE.Visible = true;
            btnF.Visible = true;
            btnG.Visible = true;
            btnH.Visible = true;
            btnI.Visible = true;
            btnJ.Visible = true;
            btnK.Visible = true;
            btnL.Visible = true;
            btnM.Visible = true;
            btnN.Visible = true;
            btnO.Visible = true;
            btnP.Visible = true;
            btnQ.Visible = true;
            btnR.Visible = true;
            btnS.Visible = true;
            btnT.Visible = true;
            btnU.Visible = true;
            btnV.Visible = true;
            btnW.Visible = true;
            btnX.Visible = true;
            btnY.Visible = true;
            btnZ.Visible = true;

            compteur              = 10;
            lblPendu.Text         = Convert.ToString(compteur);
            lblPendu.Visible      = true;
            lblinfo.Visible       = false;
            gbAlphabet.Enabled    = true;
            btnRejouer.Visible    = false;
            texteresultat.Visible = false;
            reponse.Visible       = false;
            aide.Enabled          = true;

            imagegagne.Visible = false;

            pendu10.Visible = false;
            pendu9.Visible  = false;
            pendu8.Visible  = false;
            pendu7.Visible  = false;
            pendu6.Visible  = false;
            pendu5.Visible  = false;
            pendu4.Visible  = false;
            pendu3.Visible  = false;
            pendu2.Visible  = false;
            pendu1.Visible  = false;

            lblInfoUtilisateur.Text = "";

            lblettre1.Text = "_";
            lblettre2.Text = "_";
            lblettre3.Text = "_";
            lblettre4.Text = "_";
            lblettre5.Text = "_";

            listeMots = new LesMots5Lettres();
            motAlea   = listeMots.donneUnMotAléatoire();

            reponse.Text = Convert.ToString(motAlea.affiche());
        }
Пример #31
0
        public static H3D IdentifyAndOpen(string FileName, H3DDict <H3DBone> Skeleton = null)
        {
            //Formats that can by identified by extensions
            string FilePath = Path.GetDirectoryName(FileName);

            switch (Path.GetExtension(FileName).ToLower())
            {
            case ".txt":
                H3D AllFiles = new H3D();

                string[] files = File.ReadAllLines(FileName);

                string Parent = FilePath;

                foreach (string File in files)
                {
                    AllFiles.Merge(IdentifyAndOpen(Path.Combine(Parent, File)));
                }

                return(AllFiles);

            case ".gmp":
                H3D           OutputH3D = new H3D();
                GF1MotionPack MotPack   = new GF1MotionPack(new BinaryReader(new FileStream(FileName, FileMode.Open)));
                foreach (GF1Motion Mot in MotPack)
                {
                    H3DAnimation SklAnim = Mot.ToH3DSkeletalAnimation(Skeleton);

                    SklAnim.Name = $"Motion_{Mot.Index}";

                    OutputH3D.SkeletalAnimations.Add(SklAnim);
                }
                return(OutputH3D);

            case ".smd": return(new SMD(FileName).ToH3D(FilePath));

            case ".obj": return(new OBJ(FileName).ToH3D(FilePath));

            case ".mtl": return(new OBJ(FileName).ToH3D(FilePath));

            case ".cmif": return(new CMIFFile(new FileStream(FileName, FileMode.Open)).ToH3D());

            case ".png":
                H3D Out = new H3D();
                Out.Textures.Add(new H3DTexture(FileName, true));
                return(Out);

            case ".gfbmdl":
                H3DModel model = new GFModel(new BinaryReader(new FileStream(FileName, FileMode.Open)), Path.GetFileNameWithoutExtension(FileName)).ToH3DModel();
                H3D      Scene = new H3D();
                Scene.Models.Add(model);
                return(Scene);

            case ".mbn":
                using (FileStream Input = new FileStream(FileName, FileMode.Open))
                {
                    H3D BaseScene = H3D.Open(File.ReadAllBytes(FileName.Replace(".mbn", ".bch")));

                    MBn ModelBinary = new MBn(new BinaryReader(Input), BaseScene);

                    return(ModelBinary.ToH3D());
                }
            }

            //Formats that can only be indetified by "magic numbers"
            H3D Output = null;

            using (FileStream FS = new FileStream(FileName, FileMode.Open))
            {
                if (FS.Length > 4)
                {
                    BinaryReader Reader = new BinaryReader(FS);

                    uint MagicNum = Reader.ReadUInt32();

                    FS.Seek(-4, SeekOrigin.Current);

                    string Magic = Encoding.ASCII.GetString(Reader.ReadBytes(4));

                    FS.Seek(0, SeekOrigin.Begin);

                    if (Magic.StartsWith("BCH"))
                    {
                        return(H3D.Open(Reader.ReadBytes((int)FS.Length)));
                    }
                    else if (Magic.StartsWith("MOD"))
                    {
                        return(LoadMTModel(Reader, FileName, Path.GetDirectoryName(FileName)));
                    }
                    else if (Magic.StartsWith("TEX"))
                    {
                        return(new MTTexture(Reader, Path.GetFileNameWithoutExtension(FileName)).ToH3D());
                    }
                    else if (Magic.StartsWith("MFX"))
                    {
                        MTShader = new MTShaderEffects(Reader);
                    }
                    else if (Magic.StartsWith("CGFX"))
                    {
                        return(Gfx.Open(FS));
                    }
                    else if (Magic.StartsWith("CMIF"))
                    {
                        return(new CMIFFile(new FileStream(FileName, FileMode.Open)).ToH3D());
                    }
                    else
                    {
                        if (GFPackage.IsValidPackage(FS))
                        {
                            GFPackage.Header PackHeader = GFPackage.GetPackageHeader(FS);

                            switch (PackHeader.Magic)
                            {
                            case "AL": Output = GFAreaLOD.OpenAsH3D(FS, PackHeader, 1); break;

                            case "AD": Output = GFPackedTexture.OpenAsH3D(FS, PackHeader, 1); break;

                            //case "BG": Output = GFL2OverWorld.OpenAsH3D(FS, PackHeader, Skeleton); break;
                            case "BS": Output = GFBtlSklAnim.OpenAsH3D(FS, PackHeader, Skeleton); break;

                            case "CM": Output = GFCharaModel.OpenAsH3D(FS, PackHeader); break;

                            case "GR": Output = GFOWMapModel.OpenAsH3D(FS, PackHeader); break;

                            case "MM": Output = GFOWCharaModel.OpenAsH3D(FS, PackHeader); break;

                            case "PC": Output = GFPkmnModel.OpenAsH3D(FS, PackHeader, Skeleton); break;

                            case "LL":
                            default:
                            case "PT": Output = GFPackedTexture.OpenAsH3D(FS, PackHeader, 0); break;

                            case "PK":
                            case "PB":
                                Output = GFPkmnSklAnim.OpenAsH3D(FS, PackHeader, Skeleton); break;
                            }
                        }
                        else
                        {
                            switch (MagicNum)
                            {
                            case 0x15122117:
                                Output = new H3D();

                                Output.Models.Add(new GFModel(Reader, "Model").ToH3DModel());

                                break;

                            case 0x15041213:
                                Output = new H3D();

                                Output.Textures.Add(new GFTexture(Reader).ToH3DTexture());

                                break;

                            case 0x00010000: Output = new GFModelPack(Reader).ToH3D(); break;

                            case 0x00060000:
                                if (Skeleton != null)
                                {
                                    Output = new H3D();

                                    GFMotion Motion = new GFMotion(Reader, 0);

                                    H3DAnimation    SklAnim = Motion.ToH3DSkeletalAnimation(Skeleton);
                                    H3DMaterialAnim MatAnim = Motion.ToH3DMaterialAnimation();
                                    H3DAnimation    VisAnim = Motion.ToH3DVisibilityAnimation();

                                    if (SklAnim != null)
                                    {
                                        Output.SkeletalAnimations.Add(SklAnim);
                                    }
                                    if (MatAnim != null)
                                    {
                                        Output.MaterialAnimations.Add(MatAnim);
                                    }
                                    if (VisAnim != null)
                                    {
                                        Output.VisibilityAnimations.Add(VisAnim);
                                    }
                                }

                                break;
                            }
                        }
                    }
                }
            }

            return(Output);
        }