Beispiel #1
0
        public SplitedTehai SplitTehai(int[] syu, List <Furo> furos, string horaPai, bool isRon)
        {
            //全通りの上がり構成を算出
            List <HoraPattern> horaMentsuList = split(syu);

            //ロン牌を含むターツが複数ある場合はそれぞれに対してロン上がりのフラグを立てて手配構成を作成。
            if (isRon)
            {
                var ronConsiderdMentsuList = new List <HoraPattern>();
                foreach (var horaMentsu in horaMentsuList)
                {
                    foreach (var tartsu in horaMentsu.TartsuList.Select((val, index) => new { val, index }).Where(e => e.val.Contains(horaPai)))
                    {
                        var considerd = horaMentsu.GetDeepCopy();
                        considerd.ChangeAsRonedTartsu(tartsu.index);
                        ronConsiderdMentsuList.Add(considerd);
                    }
                }

                horaMentsuList = ronConsiderdMentsuList;
            }



            //Make Furo Tartsu
            List <Tartsu> furoTartsu = new List <Tartsu>();

            foreach (var furo in furos)
            {
                furoTartsu.Add(new Tartsu(furo.ftype, furo.minPaiSyu));
            }
            //Add Furo
            foreach (var horaMentsu in horaMentsuList)
            {
                horaMentsu.AddFuro(furoTartsu);
            }

            //メンツ構造と種類枚数を持つオブジェクトを生成
            SplitedTehai horaMentsuData = new SplitedTehai();

            horaMentsuData.AllHoraPatternList = horaMentsuList;
            horaMentsuData.SyuNum             = syu;

            return(horaMentsuData);
        }
        public SplitedTehai SplitTehai(int[] syu, List<Furo> furos, string horaPai, bool isRon)
        {
            //全通りの上がり構成を算出
            List<HoraPattern> horaMentsuList = split(syu);

            //ロン牌を含むターツが複数ある場合はそれぞれに対してロン上がりのフラグを立てて手配構成を作成。
            if (isRon)
            {
                var ronConsiderdMentsuList = new List<HoraPattern>();
                foreach(var horaMentsu in horaMentsuList)
                {
                    foreach(var tartsu in horaMentsu.TartsuList.Select( (val,index) => new { val, index }).Where(e => e.val.Contains(horaPai)))
                    {
                        var considerd = horaMentsu.GetDeepCopy();
                        considerd.ChangeAsRonedTartsu(tartsu.index);
                        ronConsiderdMentsuList.Add(considerd);
                    }
                }

                horaMentsuList = ronConsiderdMentsuList;
            }




            //Make Furo Tartsu
            List<Tartsu> furoTartsu = new List<Tartsu>();
            foreach (var furo in furos)
            {
                furoTartsu.Add(new Tartsu(furo.ftype, furo.minPaiSyu));
            }
            //Add Furo
            foreach (var horaMentsu in horaMentsuList)
            {
                horaMentsu.AddFuro(furoTartsu);
            }

            //メンツ構造と種類枚数を持つオブジェクトを生成
            SplitedTehai horaMentsuData = new SplitedTehai();
            horaMentsuData.AllHoraPatternList = horaMentsuList;
            horaMentsuData.SyuNum = syu;

            return horaMentsuData;
        }