示例#1
0
        //Methodes
        public Pieces[,] initialisation(Tanuki tanuj1, Tanuki tanuj2, Kitsune kitsj1, Kitsune kitsj2, Koropokkuru koroj1, Koropokkuru koroj2, Kodama kodj1, Kodama kodj2)//instancie les pieces et les place a leur position initiale, vide également les reserves des joueurs
        {
            for (int i = 0; i == 2; i++)
            {
                ReserveJ1[i] = null;
            }
            for (int i = 0; i == 2; i++)
            {
                ReserveJ2[i] = null;
            }
            for (int i = 0; i == 3; i++)
            {
                for (int j = 0; j == 2; j++)
                {
                    terrain[i, i] = null;
                }
            }
            //Pieces joueurs 1
            terrain[3, 2] = tanuj1;
            terrain[3, 1] = koroj1;
            terrain[3, 0] = kitsj1;
            terrain[2, 1] = kodj1;
            //Pieces joueur 2
            terrain[0, 0] = tanuj2;
            terrain[0, 1] = koroj2;
            terrain[0, 2] = kitsj2;
            terrain[1, 1] = kodj2;

            return(terrain);
        }
        static void Main(string[] args)
        {
            Plateau PlatTest = new Plateau();

            //Pieces joueurs 1
            Tanuki      tanuj1 = new Tanuki(3, 2, 1, "");
            Koropokkuru koroj1 = new Koropokkuru(3, 1, 1, "");
            Kitsune     kitsj1 = new Kitsune(3, 0, 1, "");
            Kodama      kodj1  = PlatTest.PointerKod1;
            //Pieces joueur 2
            Tanuki      tanuj2 = new Tanuki(0, 0, 2, "");
            Koropokkuru koroj2 = new Koropokkuru(0, 1, 2, "");
            Kitsune     kitsj2 = new Kitsune(0, 2, 2, "");
            Kodama      kodj2  = PlatTest.PointerKod2;
            Pieces      piece;



            //PlatTest.initialisation(tanuj1,tanuj2,kitsj1,kitsj2,koroj1,koroj2,kodj1,kodj2);
            PlatTest.AfficheTestPlateau();
            PlatTest.AfficheReserve();

            Console.WriteLine();



            kodj2.Deplacement(3, 0, PlatTest);
            PlatTest.AfficheTestPlateau();
            PlatTest.AfficheReserve();

            piece = PlatTest.PointerKod1;

            piece.Deplacement(1, 1, PlatTest);
            PlatTest.AfficheTestPlateau();
            PlatTest.AfficheReserve();



            int[,] caseAccesible = new int[4, 3];
            caseAccesible        = piece.CaseAccessible(PlatTest);
            Console.WriteLine("");
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Console.Write(caseAccesible[i, j]);
                }
                Console.WriteLine("");
            }
            Console.WriteLine();
            Console.ReadLine();
        }