예제 #1
0
 //logs the round stats
 public void LogRound(GameLog gameLog, int roundNumber, Player playerOne, Player playerTwo, GameRiver gameRiver)
 {
     gameLog.Log("\nROUND: " + roundNumber.ToString()
                 + "\n\t" + playerOne.getHand().ToString(playerOne.getHand(), playerOne.getName())
                 + "\n\n\t" + playerTwo.getHand().ToString(playerTwo.getHand(), playerTwo.getName())
                 + gameRiver.ToString(gameRiver));
 }
예제 #2
0
        } // end of GameRiver()

        //Beginning of Player()
        static void Player()
        {
            int        userInput     = 0;
            GameDeck   myDeck        = new GameDeck();
            GameRiver  myRiver       = new GameRiver();
            PlayerHand playerOneHand = new PlayerHand();
            PlayerHand playerTwoHand = new PlayerHand();
            Player     playerOne     = new Player("Timmy", playerOneHand, true, false);
            Player     playerTwo     = new Player("Teddy", playerTwoHand, false, true);

            myDeck.Shuffle(52);

            //shower player info
            Console.WriteLine(myDeck.ToString(myDeck));
            Console.WriteLine(playerOne.ToStringPlayerInfo());
            Console.WriteLine(playerTwo.ToStringPlayerInfo());

            //refill player cards
            playerOne.RefillHand(myDeck);
            playerTwo.RefillHand(myDeck);
            //Console.WriteLine(playerOne.ToStringPlayerInfo());
            //Console.WriteLine(playerTwo.ToStringPlayerInfo());
            //Console.WriteLine(myDeck.ToString(myDeck));


            //Attacking/defendingPhase
            while (playerOne.getIsAttacking() == true)
            {
                Console.WriteLine("NEW ATTACKING PHASE");
                Console.WriteLine(playerOne.ToStringPlayerInfo());
                Console.WriteLine(playerTwo.ToStringPlayerInfo());
                Console.WriteLine("\nEnter int number for card you want to play");
                userInput = Convert.ToInt32(Console.ReadLine());
                //playerOne.AttackingPhase(myRiver, userInput);
                while (playerTwo.getIsDefending() == true)
                {
                    userInput = 0;
                    Console.WriteLine("\nEnter int number for card you want to play");
                    userInput = Convert.ToInt32(Console.ReadLine());
                    //playerTwo.DefendingPhase(myRiver, userInput);
                }
                Console.WriteLine(playerOne.ToStringPlayerInfo());
                Console.WriteLine(playerTwo.ToStringPlayerInfo());
                Console.WriteLine(myRiver.ToString(myRiver));

                //will set defending back to true for player two for new attacking phase
                playerTwo.setIsDefending(true);
            }


            Console.ReadKey();
        } // end of Player()
예제 #3
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()