예제 #1
0
        /****************************************************************************************
         * Method: ShuffleButton_Click()
         * Programmer(s): Jayce Merinchuk, Upma Sharma
         * Date: August 09, 2018
         * Description: disable shuffle button, for loop to choose new cards, while loop to
         * ensure no two cards chosen are the same, displays cards to the screen.
         * Input(s)/Output(s): No inputs, outputs new cards to the screen.
         * *************************************************************************************/
        private void ShuffleButton_Click(object sender, RoutedEventArgs e)
        {
            // Disable the Shuffle Button so it cannot be clicked twice.
            ShuffleButton.IsEnabled = false;

            // Advise the user to choose a card
            WinText.Text = "Choose a card";

            // For loop to choose the cards
            for (int i = 0; i < Cards.Length; i++)
            {
                int CardValue = RandomGenerator.Next(1, 14);
                Cards[i] = CardValue;
            }
            // While loop to ensure no duplicate cards are chosen
            while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2])
            {
                // For loop to choose the cards
                for (int i = 0; i < Cards.Length; i++)
                {
                    int CardValue = RandomGenerator.Next(1, 14);
                    Cards[i] = CardValue;
                }
            }
            // Display the cards
            Card1.DisplayCard(Cards[0]);
            Card2.DisplayCard(Cards[1]);
            Card3.DisplayCard(Cards[2]);
        }
        private void Start_Click(object sender, RoutedEventArgs e)
        {
            StatusMessage.Text = "Choose a card";

            PickCard1.IsEnabled = true;
            PickCard2.IsEnabled = true;
            PickCard3.IsEnabled = true;
            Shuffle.IsEnabled   = true;

            for (int i = 0; i < Cards.Length; i++)
            {
                int CardValue = RandomGenerator.Next(2, 14);
                Cards[i] = CardValue;
            }

            while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2])
            {
                for (int i = 0; i < Cards.Length; i++)
                {
                    int CardValue = RandomGenerator.Next(2, 14);
                    Cards[i] = CardValue;
                }
            }

            Card1.DisplayCard(Cards[0]);
            Card2.DisplayCard(Cards[1]);
            Card3.DisplayCard(Cards[2]);
        }
예제 #3
0
        private void DisplayCards()
        {
            Card1.DisplayCard(game.PlayerHand[0].CardName);
            Card2.DisplayCard(game.PlayerHand[1].CardName);
            Card3.DisplayCard(game.PlayerHand[2].CardName);
            upFaced.DisplayCard(game.upFacedCard.CardName);


            Card4.DisplayCard(game.ComputerHand[0].CardName);
            Card5.DisplayCard(game.ComputerHand[1].CardName);
            Card6.DisplayCard(game.ComputerHand[2].CardName);
        }
예제 #4
0
 private void DisplayCards()
 {
     Card1.DisplayCard(game.PlayerHand[0].CardName);
     Card2.DisplayCard(game.PlayerHand[1].CardName);
     Card3.DisplayCard(game.PlayerHand[2].CardName);
     Card4.DisplayCard(game.PlayerHand[3].CardName);
     Card5.DisplayCard(game.PlayerHand[4].CardName);
     Card6.DisplayCard(game.PlayerHand[5].CardName);
     Card7.DisplayCard(game.PlayerHand[6].CardName);
     Card8.DisplayCard(game.PlayerHand[7].CardName);
     UpCard.DisplayCard(game.upFacedCard.CardName);
     BackCard.DisplayCard("DC");
 }
        private void SetupGame()
        {
            Start.IsEnabled     = true;
            PickCard1.IsEnabled = false;
            PickCard2.IsEnabled = false;
            PickCard3.IsEnabled = false;
            Shuffle.IsEnabled   = false;

            Card1.DisplayCard(1);
            Card2.DisplayCard(1);
            Card3.DisplayCard(1);
            PlayerCard.DisplayCard(1);
            CPUCard.DisplayCard(1);

            StatusMessage.Text = "Press Start!";
        }
        private void PickCard3_Click(object sender, RoutedEventArgs e)
        {
            PickCard1.IsEnabled = false;
            PickCard2.IsEnabled = false;
            PickCard3.IsEnabled = false;
            Shuffle.IsEnabled   = false;

            PlayerCard.DisplayCard(Cards[2]);

            Card1.DisplayCard(14);
            Card2.DisplayCard(14);
            Card3.DisplayCard(14);

            int PlayerIndex = Cards[2];

            GameRules(PlayerIndex);
        }
예제 #7
0
        /****************************************************************************************
         * Method: SetupGame()
         * Programmer(s): Jayce Merinchuk, Upma Sharma
         * Date: August 09, 2018
         * Description: This method  enables/disables starting buttons, sets up the backs of the
         * cards, and tells the user to press the start button.
         * Input(s)/Output(s): No inputs, outputs a card picture and a message to the screen.
         * *************************************************************************************/
        private void SetupGame()
        {
            // Ensure only the start game button is waiting to be pressed
            StartGameButton.IsEnabled = true;
            PickCard1.IsEnabled       = false;
            PickCard2.IsEnabled       = false;
            PickCard3.IsEnabled       = false;
            ShuffleButton.IsEnabled   = false;

            // Start the game seeing the backs of the cards
            Card1.DisplayCard(14);
            Card2.DisplayCard(14);
            Card3.DisplayCard(14);
            ChosenCard.DisplayCard(14);
            OpponentCard.DisplayCard(14);

            // Notify User to press Start Game Button
            WinText.Text           = "Click The Start Game Button!";
            PlayerScoreText.Text   = $"Player Score: {PlayerScore}";
            OpponentScoreText.Text = $"Opponent Score: {OpponentScore}";
        }
예제 #8
0
        /****************************************************************************************
         * Method: Start_Click()
         * Programmer(s): Jayce Merinchuk, Upma Sharma
         * Date: August 09, 2018
         * Description: Display the back of cards, enable buttons, for loop to pick new cards,
         * while loop to ensure no two cards picked were the same, output cards to the screen.
         * Input(s)/Output(s): No inputs, removes text message, enables buttons, outputs new
         * cards to the screen.
         * *************************************************************************************/
        private void Start_Click(object sender, RoutedEventArgs e)
        {
            // Set the text of the start Game Button back to "Start Game" and clear the Card Value text Box
            StartGameButton.Content = "Start Game";
            CardValueText.Text      = "Card Value = ";

            // Start the game seeing the backs of the cards
            ChosenCard.DisplayCard(14);
            OpponentCard.DisplayCard(14);

            // Advise the user to choose a card
            WinText.Text = "Choose a card";

            // Enable the game buttons
            PickCard1.IsEnabled     = true;
            PickCard2.IsEnabled     = true;
            PickCard3.IsEnabled     = true;
            ShuffleButton.IsEnabled = true;

            // For loop to choose the cards
            for (int i = 0; i < Cards.Length; i++)
            {
                int CardValue = RandomGenerator.Next(1, 14);
                Cards[i] = CardValue;
            }
            // While loop to ensure no duplicate cards are chosen
            while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2])
            {
                // For loop to choose the cards
                for (int i = 0; i < Cards.Length; i++)
                {
                    int CardValue = RandomGenerator.Next(1, 14);
                    Cards[i] = CardValue;
                }
            }
            // Display Cards
            Card1.DisplayCard(Cards[0]);
            Card2.DisplayCard(Cards[1]);
            Card3.DisplayCard(Cards[2]);
        }
예제 #9
0
        /****************************************************************************************
         * Method: PickCard3Button_Click()
         * Programmer(s): Jayce Merinchuk, Upma Sharma
         * Date: August 09, 2018
         * Description: Disables buttons, puts chosen card in box, changes 3 cards to display
         * the back of the card, runs the ApplyGameRules() method.
         * Input(s)/Output(s): Input - button is clicked, Output: Back of cards displayed, chosen
         * card is placed in ChosenCard Box.
         * *************************************************************************************/
        private void PickCard3Button_Click(object sender, RoutedEventArgs e)
        {
            // Disable other buttons once a card has been chosen
            PickCard1.IsEnabled     = false;
            PickCard2.IsEnabled     = false;
            PickCard3.IsEnabled     = false;
            ShuffleButton.IsEnabled = false;

            // Put chosen card in the Chosen Card box
            ChosenCard.DisplayCard(Cards[2]);

            // Show the back of cards in the 3 upper boxes
            Card1.DisplayCard(14);
            Card2.DisplayCard(14);
            Card3.DisplayCard(14);

            // Player Index Chosen
            int PlayerIndex = Cards[2];

            // Run the rules of the game
            ApplyGameRules(PlayerIndex);
        }
예제 #10
0
 private void DisplayCards()
 {
     Card1.DisplayCard(game.PlayerCards[0]);
     Card2.DisplayCard(game.PlayerCards[1]);
     Card3.DisplayCard(game.PlayerCards[2]);
 }
예제 #11
0
 private void DisplayCards()
 {
     Card1.DisplayCard($"{game.PlayerCards[0]}C");
     Card2.DisplayCard($"{game.PlayerCards[1]}C");
     Card3.DisplayCard($"{game.PlayerCards[2]}C");
 }