public static Klondike Generate()
        {
            var dictionary = new Dictionary <Card, IPosition>();

            var cards = CardListGenerator.GenerateNoJokerShuffledCardList();

            var cardListIndex = 0;

            foreach (Column column in Enum.GetValues(typeof(Column)))
            {
                for (var i = 0; i < (int)column; i++)
                {
                    dictionary.Add(cards[cardListIndex++], new Tableau(column, i, false));
                }

                dictionary.Add(cards[cardListIndex++], new Tableau(column, (int)column, true));
            }

            for (int i = 0; cardListIndex < cards.Count; i++)
            {
                dictionary.Add(cards[cardListIndex++], new Stock(i));
            }


            return(new Klondike(dictionary));
        }
        public static Pyramid GeneratePyramid()
        {
            var dictionary = new Dictionary <Card, IPosition>();

            var cardList = CardListGenerator.GenerateNoJokerShuffledCardList();

            var cardListIndex = 0;

            for (int row = Field.RowMin; row < Field.RowMaxCount; row++)
            {
                for (int number = 0; number <= row; number++)
                {
                    dictionary.Add(cardList[cardListIndex++], new Field(row, number));
                }
            }

            // 残りは山札
            for (int i = 0; cardListIndex < cardList.Count; i++)
            {
                dictionary.Add(cardList[cardListIndex++], new Deck(i));
            }

            // ジョーカー2枚はフリースペースに
            dictionary.Add(Card.Joker, new FreeSpace(0));
            dictionary.Add(Card.ExtraJoker, new FreeSpace(1));

            return(new Pyramid(dictionary));
        }
예제 #3
0
 /// <summary>
 /// 全てのカードを山札に配置したCalculationを生成する。
 /// </summary>
 /// <returns>生成したCalculation</returns>
 public static Calculation GenerateAllStockGame()
 {
     return(new Calculation(
                CardListGenerator.GenerateNoJokerShuffledCardList()
                .Select((card, index) => (card, index))
                .ToDictionary(pair => pair.card,
                              pair => (IPosition) new Stock(pair.index))));
 }
        public static FreeCell Generate()
        {
            var dictionary = new Dictionary <Card, IPosition>();

            var cards = CardListGenerator.GenerateNoJokerShuffledCardList();

            var cardListIndex = 0;

            foreach (Column column in Enum.GetValues(typeof(Column)))
            {
                for (var i = 0; i < (column <= Column.Fourth ? 7 : 6); i++)
                {
                    dictionary.Add(cards[cardListIndex++], new Tableau(column, i));
                }
            }


            return(new FreeCell(dictionary));
        }
예제 #5
0
        /// <summary>
        /// 各台札にA,2,3,4を配置したCalculationを生成する。
        /// </summary>
        /// <returns>生成したCalculation</returns>
        public static Calculation Generate()
        {
            var dictionary = new Dictionary <Card, IPosition>();

            var cards = CardListGenerator.GenerateNoJokerShuffledCardList();

            var ace = cards.First(e => e.Rank == Rank.Ace);

            dictionary.Add(ace, new Foundation(FoundationColumn.First));
            cards.Remove(ace);

            var two = cards.First(e => e.Rank == Rank.Two);

            dictionary.Add(two, new Foundation(FoundationColumn.Second));
            cards.Remove(two);

            var three = cards.First(e => e.Rank == Rank.Three);

            dictionary.Add(three, new Foundation(FoundationColumn.Third));
            cards.Remove(three);

            var four = cards.First(e => e.Rank == Rank.Four);

            dictionary.Add(four, new Foundation(FoundationColumn.Fourth));
            cards.Remove(four);

            var drawCard = cards[0];

            dictionary.Add(drawCard, new WastePile());
            cards.Remove(drawCard);

            for (int i = 0; i < cards.Count; i++)
            {
                dictionary.Add(cards[i], new Stock(i));
            }


            return(new Calculation(dictionary));
        }
예제 #6
0
        public static NotFantanDomino Generate()
        {
            var cardList = CardListGenerator.GenerateNoJokerShuffledCardList();

            var dictionary = new Dictionary <Card, Position>();

            while (cardList.Count() > 0)
            {
                foreach (var playerNumber in Enum.GetValues(typeof(PlayerNumber)))
                {
                    dictionary.Add(cardList.Dequeue(), (Position)playerNumber);

                    if (cardList.Count() <= 0)
                    {
                        break;
                    }
                }
            }


            return(new NotFantanDomino(dictionary));
        }
예제 #7
0
 /// <summary>
 /// ジョーカーなしのGolfを生成
 /// </summary>
 /// <param name="canLoop">AとK(13)の間で行き来できるか。</param>
 /// <returns>生成したGolf</returns>
 public static Golf GenerateNoJokerGolf(bool canLoop)
 {
     return(GenerateGolf(CardListGenerator.GenerateNoJokerShuffledCardList(), canLoop));
 }