Exemplo n.º 1
0
        static void Main(string[] args)
        {
            IGame game = null;

            Console.WriteLine("選擇遊戲1:Hanoi or 2:Guess");
            string input_string = Console.ReadLine();
            int    input        = int.Parse(input_string);

            switch (input)
            {
            case 1:
                game = new HanoiGame();
                break;

            case 2:
                game = new GuessGame();

                break;
            }
            game.Setup();
            game.Play();
            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //int choose = 0;
            IGame game = null;

            Console.WriteLine("請輸入1或2");
            int result = GameHelper.GetInt(1, 2);

            //string input = Console.ReadLine();
            //int result = int.Parse(input);
            switch (result)
            {
            case 1:
                game = new HanoiGame();
                break;

            case 2:
                game = new GuessGame();
                break;
            }

            /*
             * if (choose == 1)
             * {
             *  game = new HanoiGame();
             * }
             * if(choose == 2)
             * {
             *  game = new GuessGame();
             * }
             */
            game.Setup();
            game.Play();

            Console.ReadKey();
        }