示例#1
0
        public DefaultSnapGameType(ICardDealerLogic cardDealer, ICardCollectionFactory cardCollectionFactory)
        {
            Check.NotNull(cardDealer, "cardDealer");
            Check.NotNull(cardCollectionFactory, "cardCollectionFactory");

            var decksOfPlayers = cardDealer.DealCards(PlayerCount);

            Players = new List <ICardGamePlayer>()
            {
                new Player("Ray", decksOfPlayers[0], cardCollectionFactory.CreateCardCollection()),
                new Player("Lucy", decksOfPlayers[1], cardCollectionFactory.CreateCardCollection()),
                new Player("Steve", decksOfPlayers[2], cardCollectionFactory.CreateCardCollection()),
                new Player("Player 1", decksOfPlayers[3], cardCollectionFactory.CreateCardCollection()),
            };

            DealingLogic = cardDealer;
        }
示例#2
0
        public IList <ICardCollection> DealCards(int playerCount)
        {
            var result = new List <ICardCollection>();

            for (int i = 0; i < playerCount; i++)
            {
                var collection = m_cardCollectionFactory.CreateCardCollection();
                // deal the card equally between the players.
                collection = GenerateCardsFor(collection, (_totalCardCount / playerCount));
                result.Add(collection);
            }

            return(result);
        }