コード例 #1
0
        static void Main(string[] args)
        {
            Grille maGrille = new Grille();

            Console.Clear();
            if (ReadName(1) != "Q")
            {
                if (ReadName(2) != "Q")
                {
                    Console.Clear();
                    maGrille.DrawGraph();
                    int     joueur = 1;
                    Boolean theEnd = false;
                    while (theEnd != true)
                    {
                        theEnd = maGrille.Play(joueur);
                        if (theEnd != true)
                        {
                            maGrille.DrawGraph();
                            joueur++;
                            if (joueur == 3)
                            {
                                joueur = 1;
                            }
                        }
                    }
                }
            }
            Console.ReadKey();
        }
コード例 #2
0
        public FenetrePrincipale()
        {
            InitializeComponent();

            ClientSize = new System.Drawing.Size(Constantes.WIDTH - 6, Constantes.HEIGHT + Constantes.SIZE_H + Constantes.MARGIN_TOP + Constantes.MARGIN_BOTTOM - 6);
            this.grille = new Grille();
            this.jeton = new Jeton(Constantes.WIDTH / 2 - Constantes.SIZE_W / 2, 0);
            initBarreScores();
            initManche();

            Refresh();
        }
コード例 #3
0
        public FenetrePrincipale()
        {
            #region Puissance4
            InitializeComponent();

            ClientSize = new System.Drawing.Size(Constantes.WIDTH - 6, Constantes.HEIGHT + Constantes.SIZE_H + Constantes.MARGIN_TOP + Constantes.MARGIN_BOTTOM - 6);

            this.grille = new Grille();
            this.jeton = new Jeton(joueur, Constantes.WIDTH / 2 - Constantes.SIZE_W / 2, 0);
            #endregion

            initBarreScores();
            initVariables();
            Refresh();
        }
コード例 #4
0
        public static void LaunchGame(int player)
        {
            int  returnPos = 0;
            int  tours     = 0;
            bool Win       = false;

            Joueur j1;
            Joueur j2;

            if (player == 1)
            {
                j1 = new JoueurHumain("1", Puissance4.Jeton1, ConsoleColor.Red);
                j2 = new JoueurHumain("2", Puissance4.Jeton2, ConsoleColor.Yellow);
            }
            else
            {
                j1 = new JoueurHumain("1", Puissance4.Jeton1, ConsoleColor.Red);
                j2 = new JoueurIA("2", Puissance4.Jeton2, ConsoleColor.Yellow);
            }

            Joueur[] tableauJoueur = { j1, j2 };

            Grille g = new Grille();

            Affichage.HelpCommand(tableauJoueur);

            while (tours < 41 && Win == false)
            {
                for (int i = 0; i < tableauJoueur.Length; i++)
                {
                    while (g.PlacerPiont(returnPos - 1, tableauJoueur[i]))
                    {
                        returnPos = tableauJoueur[i].ChoixPosition();
                    }
                    returnPos = 0;
                    Affichage.AfficheGrille(Grille.Ligne, Grille.Colonne);
                    Win = g.TestWin(tableauJoueur[i]);
                    if (Win)
                    {
                        break;
                    }
                }
            }
            Console.Clear();
            Console.WriteLine(Win);
        }