Exemplo n.º 1
0
        private void findNormalYaku()
        {
            //それぞれの面子の完成形で判定する
            foreach (MentsuComp comp in hands.getMentsuCompSet())
            {
                //役をストックしておく
                List <NormalYaku>            yakuStock = new List <NormalYaku>(7);
                HashSet <NormalYakuResolver> resolverSet
                    = Mahjong4jYakuConfig.getNormalYakuResolverSet(comp, generalSituation, personalSituation);
                foreach (NormalYakuResolver resolver in resolverSet)
                {
                    if (resolver.isMatch())
                    {
                        yakuStock.Add(resolver.getNormalYaku());
                    }
                }

                int hanSum = calcHanSum(yakuStock);
                if (hanSum > this.han)
                {
                    han            = hanSum;
                    normalYakuList = yakuStock;
                    this.comp      = comp;
                }
            }

            if (han > 0)
            {
                calcDora(hands.getHandsComp(), generalSituation, normalYakuList.Contains(NormalYaku.REACH));
            }
            calcScore();
        }
Exemplo n.º 2
0
        /**
         * @return 役満が見つかったか
         */
        private bool findYakuman()
        {
            //役満をストックしておき、見つかったら先にこちらに保存する
            List <Yakuman> yakumanStock = new List <Yakuman>(4);

            //それぞれの面子の完成形で判定する
            foreach (MentsuComp comp in hands.getMentsuCompSet())
            {
                HashSet <YakumanResolver> yakumanResolverSet
                    = Mahjong4jYakuConfig.getYakumanResolverSet(comp, generalSituation, personalSituation);

                foreach (YakumanResolver resolver in yakumanResolverSet)
                {
                    if (resolver.isMatch())
                    {
                        yakumanStock.Add(resolver.getYakuman());
                    }
                }

                //ストックと保存する役満リストと比較し大きい方を保存する
                if (yakumanList.Count() < yakumanStock.Count())
                {
                    yakumanList = yakumanStock;
                    this.comp   = comp;
                }
            }

            return(yakumanList.Count() > 0);
        }