Пример #1
0
 public UnoGame(IDeck deck)
 {
     _tableDeck = new TableDeck();
     _deck = deck;
     _cardRules = _deck.GetCardRules();
     _playersInGame = new List<Player>();
     _currentPlayersTurn = 0;
 }
Пример #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;
        }
Пример #3
0
        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));
                    }
                }
            }
        }
Пример #4
0
 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);
 }