Esempio n. 1
0
        } // end of CardSuitsEnum()

        //Beginning of GameDeck()
        static void GameDeck()
        {
            GameDeck myDeck = new GameDeck();

            myDeck.Shuffle(52);

            //showdeck
            Console.WriteLine(myDeck.ToString(myDeck));

            //player one draws a single card from deck
            Card card1;

            card1 = myDeck.DrawCard();
            Console.WriteLine(card1.ToString(1));

            //showdeck
            Console.WriteLine(myDeck.ToString(myDeck));

            //creates two player objects
            PlayerHand playerOneHand = new PlayerHand();
            PlayerHand playerTwoHand = new PlayerHand();

            //player one adds drawn card to hand
            playerOneHand.AddCardToHand(card1);
            Console.WriteLine(playerOneHand.ToString(playerOneHand, 1));


            //player two draws 6 cards
            CardList cardsDrawn1;

            cardsDrawn1 = myDeck.DrawCards(6);
            Console.WriteLine(cardsDrawn1.ToString(cardsDrawn1, 2));

            //playertwo adds cards to hand
            playerTwoHand.AddCardsToHand(cardsDrawn1);
            Console.WriteLine(playerTwoHand.ToString(playerTwoHand, 2));


            //playertwo chooses two cards from hand
            Card choosenCardFromHand1;

            choosenCardFromHand1 = playerTwoHand.ChooseCardFromHand(2);
            Card choosenCardFromHand3;

            choosenCardFromHand3 = playerTwoHand.ChooseCardFromHand(0);
            Console.WriteLine(playerTwoHand.ToString(playerTwoHand, 2));

            //player one draws cards from deck
            CardList cardsDrawn2;

            cardsDrawn2 = myDeck.DrawCards(5);
            Console.WriteLine(cardsDrawn2.ToString(cardsDrawn2, 1));
            playerOneHand.AddCardsToHand(cardsDrawn2);
            Console.WriteLine(playerOneHand.ToString(playerOneHand, 1));

            //playerone chooses two cards from hand
            Card choosenCardFromHand2;

            choosenCardFromHand2 = playerOneHand.ChooseCardFromHand(1);
            Card choosenCardFromHand4;

            choosenCardFromHand4 = playerOneHand.ChooseCardFromHand(2);
            Console.WriteLine(playerOneHand.ToString(playerOneHand, 1));

            //choosen card from playertwo put in gameriver1 list
            GameRiver gameRiver1 = new GameRiver();

            //player two choosen cards added to river
            gameRiver1.AddCardToRiver(choosenCardFromHand1);
            gameRiver1.AddCardToRiver(choosenCardFromHand3);

            //player one choosen cards added to river
            gameRiver1.AddCardToRiver(choosenCardFromHand2);
            gameRiver1.AddCardToRiver(choosenCardFromHand4);
            Console.WriteLine(gameRiver1.ToString(gameRiver1));


            //Console.WriteLine(gameRiver1.cardRiverComparison());



            Console.ReadKey();



            //GameDeck Functionality
            GameDeck deck1 = new GameDeck();
            GameDeck deck2 = (GameDeck)deck1.Clone();

            Console.WriteLine("\nThe first card in the original deck is: {0}",
                              deck1.GetCard(0));
            Console.WriteLine("The first card in the cloned deck is: {0}",
                              deck2.GetCard(0));
            deck1.Shuffle(52);
            Console.WriteLine("Original deck shuffled.");
            Console.WriteLine("The first card in the original deck is: {0}",
                              deck1.GetCard(0));
            Console.WriteLine("The first card in the cloned deck is: {0}",
                              deck2.GetCard(0));

            Console.ReadKey();
        } // end of GameDeck()
Esempio n. 2
0
        //will refill player hand
        public void RefillHand(GameDeck deck)
        {
            CardList cards = deck.DrawCards(6 - hand.length());

            hand.AddCardsToHand(cards);
        }