Exemplo n.º 1
0
        public override Position Clone()
        {
            PositionP4 a = new PositionP4(j1aletrait, lignes, colonnes);

            for (int i = 0; i < lignes; i++)
            {
                for (int j = 0; j < colonnes; j++)
                {
                    int qsd = mat[i, j];
                    a.mat[i, j] = qsd;
                }
            }
            a.NbCoups = this.NbCoups;
            a.Eval    = this.Eval;
            return(a);
        }
Exemplo n.º 2
0
        public override bool Equals(Object obj)
        {
            PositionP4 o = (PositionP4)obj;

            if (this.lignes != o.lignes || this.colonnes != o.colonnes)
            {
                return(false);
            }
            for (int i = 0; i < lignes; i++)
            {
                for (int j = 0; j < lignes; j++)
                {
                    if (mat[i, j] != o.mat[i, j])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            //Programme de projet d'inforamtique de Xavier Bitsch et Alexandre Chevaux


            JMCTS j1 = new JMCTS(100, 100, 100);
            JMCTS j2 = new JMCTS(10, 10, 100);

            PositionP4 posall = new PositionP4(true, 6, 7);
            Partie     P4     = new Partie(j1, j2, posall);

            P4.Commencer(false);

            j1.NouvellePartie();
            j2.NouvellePartie();



            JMCTSp     j1p             = new JMCTSp(100, 100, 100, 4);
            JMCTSp     j2p             = new JMCTSp(10, 10, 100, 4);
            PositionP4 puissanceJMCTSp = new PositionP4(true, 6, 7);
            Partie     P4JMCTSp        = new Partie(j1p, j2p, puissanceJMCTSp);

            P4JMCTSp.Commencer(false);

            j1p.NouvellePartie(); j2p.NouvellePartie();



            JMCTSP     j1P             = new JMCTSP(100, 100, 100, 4);
            JMCTSP     j2P             = new JMCTSP(10, 10, 100, 4);
            PositionP4 puissanceJMCTSP = new PositionP4(true, 6, 7);
            Partie     P4JMCTSP        = new Partie(j1P, j2P, puissanceJMCTSP);

            P4JMCTSP.Commencer(false);



            /*Code pour tester plusieurs valeurs de a*/

            /*
             * int cpt = 0;
             * int cptnul = 0;
             * string[,] matricedeRes = new string[10,10];
             * int gg = 0;
             * string somme = "";
             * int m = 0;
             * int l = 0;
             * int cptj2 = 0;
             * Stopwatch sw = new Stopwatch();
             * sw.Start();
             * for (int k = 6; k < 15; k++)
             * {
             *
             *  for (int j = 1; j < 51; j=j+5)
             *  {
             *
             *      for (int i = 0; i < 20; i++)
             *      {
             *          JMCTSP j1 = new JMCTSP(k, k, 100,4);
             *          JMCTSP j2 = new JMCTSP(j, j,100,4);
             *          PositionP4 posall = new PositionP4(true,6,7);
             *          Partie P4 = new Partie(j1, j2, posall);
             *
             *          P4.Commencer(false);
             *          j1.NouvellePartie();j2.NouvellePartie();
             *         if (P4.r == Resultat.j0gagne) cpt++;
             *          if (P4.r == Resultat.partieNulle) cptnul++;
             *          if (P4.r == Resultat.j1gagne) cptj2++;
             *      }
             *      somme = cpt.ToString() + " " + cptnul.ToString()+" "+cptj2.ToString();
             *      matricedeRes[m, l] = somme;
             *      Console.WriteLine(k + " " + j + " " + matricedeRes[m, l]);
             *      cpt = 0;
             *      cptnul = 0;
             *      cptj2 = 0;
             *      l++;
             * }
             *  l = 0;
             *  m++;
             * }
             * sw.Stop();
             * Console.WriteLine(sw.ElapsedMilliseconds);
             * for (int k = 0; k <= 9; k++)
             * {
             *  for (int j = 0; j <= 9; j++)
             *  {
             *      Console.Write(k + "/" + j + " =" + matricedeRes[k,j] + " ");
             *  }
             *  Console.WriteLine("");
             * }
             *
             */

            ConsoleKeyInfo keyInfo = Console.ReadKey();

            if (keyInfo.Key == ConsoleKey.Escape)
            {
                Environment.Exit(0);
            }
        }