示例#1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="squares"></param>
        /// <param name="status"></param>
        public Board(int numberOfCards)
        {
            int fo = (numberOfCards * numberOfCards) / 2;
            _Cards.Clear();
            Card tp;
            for (int i = 0; i < fo; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    do
                    {
                        tp = new Card()
                        {
                            myXCoordinate = F(numberOfCards),
                            myYCoordinate = F(numberOfCards)
                        };

                        if (!CardAlreadyExists(tp)) break;

                    } while (true);

                    this._Cards.Add(tp);
                }

                EstablishMatchLink();
            }
        }
示例#2
0
 bool CardAlreadyExists(Card p)
 {
     foreach (Card v in _Cards)
     {
         if (v.myXCoordinate == p.myXCoordinate && v.myYCoordinate == p.myYCoordinate) return true;
     }
     return false;
 }