Example #1
0
 public UnoGame(IDeck deck)
 {
     _tableDeck = new TableDeck();
     _deck = deck;
     _cardRules = _deck.GetCardRules();
     _playersInGame = new List<Player>();
     _currentPlayersTurn = 0;
 }
Example #2
0
        public List<Card> CurrentlyAllowedCards(CardRules cardRules)
        {
            var allowedCards = new List<Card>();

            for (var i = cardRules.LowestNumber; i <= cardRules.HighestNumber; i++) // add all numbers of top card color
            {
                allowedCards.Add(new Card(i, (int)TopCard().Color, cardRules));
            }
            for (var i = 0; i < cardRules.AmountOfColors; i++)
            {
                allowedCards.Add(new Card(TopCard().Number, i, cardRules));
            }
            return allowedCards;
        }
Example #3
0
File: Deck.cs Project: David176/SWT
        public Deck(CardRules cardRules)
        {
            CurrentDeck = new List<Card>();
            _cardRules = cardRules;

            for (int k = 0; k < 2; k++) //amount of duplicates
            {
                for (int i = 0; i < _cardRules.AmountOfColors; i++) //each color
                {
                    for (int j = _cardRules.LowestNumber; j <= _cardRules.HighestNumber; j++) //each number
                    {
                        CurrentDeck.Add(new Card(j, i, _cardRules));
                    }
                }
            }
        }
Example #4
0
File: Card.cs Project: David176/SWT
 public Card(int number, int color, CardRules cardRules)
 {
     _cardRules = cardRules;
     Number = (number > _cardRules.HighestNumber || number < _cardRules.LowestNumber ? -1 : number);
     Color = (CardColor) (color > _cardRules.AmountOfColors-1 || color < 0 ? -1 : color);
 }