示例#1
0
        private static void Main()
        {
            #region Test

            CardStock c = new CardStock();
            c.MixUpTheCard();
            Card d = c["-1"];
            if (d != null)
            {
                Console.WriteLine(d.ToString());
            }
            Card f = new Card(EColor.Red, 1);

            #endregion

            #region Game


            Console.WriteLine("Hello and welcome in the Game\nThis a the deck of each player\n\n");
            Game myGame = new Game();
            Console.WriteLine(myGame.ToString());

            int choice = 0;
            while (choice != 3)
            {
                Console.WriteLine("[1] Do only one step \n[2] Do all the step \n[3] Exit");
                int.TryParse(Console.ReadLine(), out choice);

                switch (choice)
                {
                case 1:
                    myGame.StepInGame();
                    break;

                case 2:

                    while (myGame.EndOfGame() != true)
                    {
                        myGame.StepInGame();
                        //Console.WriteLine(myGame.CheckWinner());
                    }

                    Console.WriteLine("The winner is {0}", myGame.CheckWinner());
                    break;

                case 3:
                    break;

                default:
                    Console.WriteLine("Not a valide input");
                    break;
                }
                #endregion
            }
        }
示例#2
0
        //constructor which is reset the game
        public Game(params string[] p)
        {
            //prepare the jackpot to contain all the cards
            jackpot = new CardStock();
            jackpot.Shuffle();
            //initalizing n players here in 2
            gamePlayer = new Player[p.Length];
            int i = 0;

            //initalize the players name as players
            foreach (string person in p)
            {
                gamePlayer[i]      = new Player();
                gamePlayer[i].Name = person;
                i++;
            }
            //distribute cards to the players
            jackpot.Distribute(gamePlayer);
        }