Exemple #1
0
        private static void StartGame()
        {
            BoardSettings boardSettings = new BoardSettings()
            {
                Columns = 7, Rows = 6, WinningCount = 4
            };

            Connect4 c4 = new Connect4(boardSettings, new Message());

            c4.Player1 = new Human();
            c4.Player2 = new Computer(2, boardSettings);

            c4.PlayGame();

            System.Console.Write("Would you like another game? (Y or N)");
            char c = System.Console.ReadKey().KeyChar;

            if (c.ToString().ToUpper() == "Y")
            {
                StartGame();
            }
            else
            {
                Environment.Exit(0);
            }
        }
Exemple #2
0
        private static void StartGame()
        {
            BoardSettings boardSettings = new BoardSettings() { Columns = 7, Rows = 6, WinningCount = 4 };

            Connect4 c4 = new Connect4(boardSettings, new Message());
            c4.Player1 = new Human();
            c4.Player2 = new Computer(2, boardSettings);

            c4.PlayGame();

            System.Console.Write("Would you like another game? (Y or N)");
            char c = System.Console.ReadKey().KeyChar;
            if (c.ToString().ToUpper() == "Y")
                StartGame();
            else
                Environment.Exit(0);
        }
Exemple #3
0
        private static void StartGame()
        {
            Connect4 c4 = new Connect4(new BoardSettings() { Columns = 7, Rows = 6 }, new Message());
            c4.Player1 = new Human();
            c4.Player2 = new Computer(2);

            //Uncomment code below for Computer vs computer game.
            c4.Player1 = new Computer(1);
            (c4.Player1 as Computer).CutOffLevel = 7;
            (c4.Player2 as Computer).Weights = new int[] { 1, 2, 4, 8, 1, 2, 8, 16 };

            c4.PlayGame();

            System.Console.Write("Would you like another game? (Y or N)");
            char c = System.Console.ReadKey().KeyChar;
            if (c.ToString().ToUpper() == "Y")
                StartGame();
            else
                Environment.Exit(0);
        }