コード例 #1
0
 public Game(IDeck deck, IShuffleCards shuffleCards, IPlayCardLogic playCardLogic)
 {
     _deck          = deck;
     _cards         = deck.Cards.ToList();
     _shuffleCards  = shuffleCards;
     _playCardLogic = playCardLogic;
 }
コード例 #2
0
        public static IEnumerable <Player> BuildPlayers(int count, IShuffleCards cardsShuffler)
        {
            if (count < 2)
            {
                throw new ArgumentException("Should have at least 2 players in a game");
            }

            IEnumerable <Player> players = Enumerable.Range(0, count: count).Select(id => new Player(id, cardsShuffler)).ToList();

            return(players);
        }
コード例 #3
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="id">Player's id</param>
 /// <param name="cardsShuffler">Used for shuffling earned cards</param>
 public Player(int id, IShuffleCards cardsShuffler)
 {
     _cardsShuffler = cardsShuffler;
     Id             = id;
 }