Пример #1
0
        /// <summary>
        /// Removes the last avalable dice in the cup
        /// </summary>
        /// <exception cref="InvalidOperationException" />
        /// <returns>NDice removed from cup</returns>
        public IDice PopDice()
        {
            if (Count == 0)
            {
                throw new InvalidOperationException("There are no dice in the cup.");
            }

            IDice oldDice = AllDice[Count - 1];

            AllDice.RemoveAt(Count - 1);

            return(oldDice);
        }
Пример #2
0
 public GameViewModel(string playerone, string playertwo)
 {
     PlayerOne = playerone;
     PlayerTwo = playertwo;
     GameBoard = new string[16];
     for (var i = 0; i < AllDice.Count(); i++)
     {
         int    rand       = new Random().Next(0, 5);
         string randletter = AllDice[i][rand];
         GameBoard[i] = randletter;
     }
     GameBoard = Shuffle(GameBoard);
 }
Пример #3
0
 /// <summary>
 /// Adds a dice to the cup
 /// </summary>
 /// <param name="dice">Dice to be added to the cup</param>
 public void PushDice(IDice dice)
 {
     AllDice.Add(dice);
 }