示例#1
0
        static void Main(string[] args)
        {
            // create two players
            Human h0 = new Human(0, "Joe", 1000);
            Human h1 = new Human(1, "Sue", 1000);

            Player7 p7a = new Player7(0, "George", 1000);
            Player7 p7b = new Player7(1, "Jimmy", 1000);

            // create the Game
            Game myGame = new Game(p7a, p7b);

            myGame.Tournament(); // run the game
        }
示例#2
0
        static void Main(string[] args)
        {
            /* --------------------------------
             * Old testing code
             * // create two players
             * Human h0 = new Human(0, "Joe", 1000);
             * Human h1 = new Human(1, "Sue", 1000);
             * ------------------------------------*/
            // create the player objects
            Player1  one   = new Player1(1, "Player1", 1000);
            Player2  two   = new Player2(2, "Player2", 1000);
            Player3  three = new Player3(3, "Player3", 1000);
            Player4  four  = new Player4(4, "Player4", 1000);
            Player5  five  = new Player5(5, "Player5", 1000);
            Player6  six   = new Player6(6, "Player6", 1000);
            Player7  seven = new Player7(7, "Player7", 1000);
            Player8  eight = new Player8(8, "Player8", 1000);
            Player9  nine  = new Player9(9, "Player9", 1000);
            Player10 ten   = new Player10(10, "Player10", 1000);

            // Select the two players for this part of the tournament
            Player p0 = null;
            Player p1 = null;

            int num1 = 0;

            do
            {
                Console.Write("Select the first player (1 - 10): ");
                string num1Str = Console.ReadLine();
                int.TryParse(num1Str, out num1);
            } while (num1 <= 0 || num1 > 10);

            switch (num1)
            {
            case 1: p0 = one; break;

            case 2: p0 = two; break;

            case 3: p0 = three; break;

            case 4: p0 = four; break;

            case 5: p0 = five; break;

            case 6: p0 = six; break;

            case 7: p0 = seven; break;

            case 8: p0 = eight; break;

            case 9: p0 = nine; break;

            case 10: p0 = ten; break;
            }

            int num2 = 0;

            do
            {
                Console.Write("Select the second player (1 - 10): ");
                string num2Str = Console.ReadLine();
                int.TryParse(num2Str, out num2);
            } while (num2 <= 0 || num2 > 10);

            switch (num2)
            {
            case 1: p1 = one; break;

            case 2: p1 = two; break;

            case 3: p1 = three; break;

            case 4: p1 = four; break;

            case 5: p1 = five; break;

            case 6: p1 = six; break;

            case 7: p1 = seven; break;

            case 8: p1 = eight; break;

            case 9: p1 = nine; break;

            case 10: p1 = ten; break;
            }

            // create the Game
            Game myGame = new Game(p0, p1);

            myGame.Tournament(); // run the game
        }