Exemplo n.º 1
0
        /// <summary>
        /// 初始化用户手中的牌,提取出固定规则的牌
        /// </summary>
        /// <param name="cards"></param>
        /// <returns>返回Item1:剩余的牌,Item2:手中的固定规则,Item3:牌桌上的规定规则</returns>
        public static Tuple <Card[], IRelation[], IRelation[]> InitUserCards(params Card[] cards)
        {
            var relations = RelationFactory.BuildFixedRelations(cards, out Card[] outputCards);

            return(new Tuple <Card[], IRelation[], IRelation[]>(
                       (from card in cards
                        where !outputCards.Contains(card)
                        select card).ToArray(),
                       (from relation in relations
                        where relation.RelationType == RelationTypes.LLL_Self ||
                        relation.RelationType == RelationTypes.SSS_Self
                        select relation).ToArray(),
                       (from relation in relations
                        where relation.RelationType == RelationTypes.LLLL_Self ||
                        relation.RelationType == RelationTypes.SSSS_Self
                        select relation).ToArray()
                       ));
        }
Exemplo n.º 2
0
        public void TestBuildFixedRelations()
        {
            var source = CardSource(21);

            foreach (var relation in RelationFactory.BuildFixedRelations(source, out Card[] outputCards))