Пример #1
0
        private static void ReplaceCardsPositions <TCard>(this ICards <TCard> board, int card1Index, int card2Index)
            where TCard : class, ICard
        {
            //Card1
            int row1    = board.GetRow(card1Index);
            int column1 = board.GetColumn(card1Index);

            //card2
            int row2    = board.GetRow(card2Index);
            int column2 = board.GetColumn(card2Index);

            board.Replace(new Point(row1, column1), new Point(row2, column2));
        }
Пример #2
0
        internal static void FillBoardAndMix <TCard>(this ICards <TCard> board, ICardBuilder <TCard> cardBuilder)
            where TCard : class, ICard
        {
            for (int cardNum = 0; cardNum < board.NumOfCards; cardNum++)
            {
                TCard[] cards = cardBuilder.GeneratePairCard();
                board.InsertCard(cards[0], board.GetRow(cardNum), board.GetColumn(cardNum));

                cardNum++;
                board.InsertCard(cards[1], board.GetRow(cardNum), board.GetColumn(cardNum));
            }

            board.MixCards(board.RemainCards);
        }