Esempio n. 1
0
        public Hand(Boneyard by, int numPlayers)
        {
            handOfDominos = new List <Domino>();

            if (numPlayers == 1)
            {
                throw new ArgumentException("numPlayers must be greater than 1");
            }
            else if (numPlayers == 2 || numPlayers == 3)
            {
                for (int i = 0; i < 16; i++)
                {
                    handOfDominos.Add(by.Draw());
                }
            }
            else if (numPlayers == 4)
            {
                for (int i = 0; i < 15; i++)
                {
                    handOfDominos.Add(by.Draw());
                }
            }
            else if (numPlayers == 5)
            {
                for (int i = 0; i < 14; i++)
                {
                    handOfDominos.Add(by.Draw());
                }
            }
            else if (numPlayers == 6)
            {
                for (int i = 0; i < 12; i++)
                {
                    handOfDominos.Add(by.Draw());
                }
            }
            else if (numPlayers == 7)
            {
                for (int i = 0; i < 10; i++)
                {
                    handOfDominos.Add(by.Draw());
                }
            }
            else if (numPlayers == 8)
            {
                for (int i = 0; i < 9; i++)
                {
                    handOfDominos.Add(by.Draw());
                }
            }
            else
            {
                throw new ArgumentException("numPlayers cannot be greater than 8");
            }
        }
Esempio n. 2
0
        public Hand()
        {
            handOfDominos = new List <Domino>();

            Boneyard by = new Boneyard();

            for (int i = 0; i < 15; i++)
            {
                handOfDominos.Add(by.Draw());
            }
        }
Esempio n. 3
0
 public void Draw(Boneyard by) => this.Add(by.Draw());