Example #1
0
        public List <Card> TakeCards()
        {
            List <Card> Result = this.Cards.Cards;

            this.Cards = new CL_cards(new List <Card>());
            return(Result);
        }
Example #2
0
 public CL_player(PlayerType_Enum type, string name, CL_cards cards)
 {
     this.Points = 0;
     this.Name   = name;
     this.Cards  = cards;
     this.Type   = type;
 }
Example #3
0
 public CL_player(PlayerType_Enum type, string name)
 {
     this.Points = 0;
     this.Name   = name;
     this.Cards  = new CL_cards(new List <Card>());
     this.Type   = type;
 }
Example #4
0
 public void GiveCards(List <Card> cards)
 {
     if (cards.Count != 2 && this.Type == PlayerType_Enum.Person)
     {
         throw new System.ArgumentException("The player is a person : it is supposed to have 2 cards");
     }
     else if (cards.Count != 3 && this.Type == PlayerType_Enum.Bank)
     {
         throw new System.ArgumentException("The player is a bank : it is supposed to have 3 cards");
     }
     else
     {
         this.Cards = new CL_cards(cards);
     }
 }
Example #5
0
        //True if the bank won the game
        static void playRound(CL_player bank, CL_player player1, CL_player player2)
        {
            CL_cards    cards    = new CL_cards();
            CL_croupier croupier = new CL_croupier(cards);

            croupier.Cards.Shuffle();
            croupier.GiveCards(bank);
            croupier.GiveCards(player1);
            croupier.GiveCards(player2);

            List <CL_player> list = new List <CL_player>();

            list.Add(bank);
            list.Add(player1);
            list.Add(player2);

            croupier.WhoWins(list);
        }
Example #6
0
 public CL_croupier(CL_cards cards)
 {
     this.Cards = cards;
 }