Example #1
0
        private void Split(List <Card> cards)
        {
            var counter = 0;

            foreach (var item in cards)
            {
                if (counter < 26)
                {
                    PlayerOneHand.Add(item);
                }
                else
                {
                    PlayerTwoHand.Add(item);
                }
                counter++;
            }
        }
Example #2
0
        public void Deal()
        {
            if (PlayerOneHand.Count < 4 || PlayerTwoHand.Count < 4)
            {
                if (PlayerOneHand.Count < PlayerTwoHand.Count)
                {
                    //Player 1 wins
                }
                else if (PlayerTwoHand.Count < PlayerOneHand.Count)
                {
                    //Player 2 wins
                }
                else
                {
                    //Add points logic
                }
            }

            //Set the position for the top four cards of player one to the gameboard
            for (int i = 0; i < 4; i++)
            {
                PlayerOneHand[i].Position = i + 1;

                //Add to cards in game list
                CardsInGame.Add(PlayerOneHand[i]);

                //Remove from hand list
                PlayerOneHand.RemoveAt(i);
            }

            //Set the position for the top four cards of player two to the gameboard
            for (int i = 4; i < 8; i++)
            {
                PlayerTwoHand[i].Position = i + 1;

                //Add to cards in game list
                CardsInGame.Add(PlayerTwoHand[i]);

                //Remove from hand list
                PlayerTwoHand.RemoveAt(i);
            }
        }