public void 和了時構成分割テスト() { Tehai testTehai = new Tehai(new List <string> { "1m", "2m", "3m", "4m", "5m", "6m", "7m", "7m", "1m", "1m", "2m", "2m", "3m" }); var isRon = true; var result = SplitedTehaiCalclator.CalcSplitedTehai(testTehai, "3m", isRon); Debug.WriteLine(result.AllHoraPatternList.Count); foreach (var r in result.AllHoraPatternList) { foreach (var t in r.TartsuList) { Debug.WriteLine(t.TartsuType + "," + t.TartsuStartPaiSyu); } Debug.WriteLine(""); } Assert.AreEqual(result.AllHoraPatternList.Count, 4);//testTehaiは111222333の部分が順子3つのパターンと暗刻3つのパターンがある }
public static HoraResult CalcHoraResult(Tehai tehai, InfoForResult ifr, Field field, string horaPai) { //面子手の取りうる和了形を全て列挙 SplitedTehai splited = SplitedTehaiCalclator.CalcSplitedTehai(tehai, horaPai, !ifr.IsTsumo); List <YakuResult> yakuResultList = new List <YakuResult>(); //面子手和了型が0の場合はチートイツか国士無双 if (splited.AllHoraPatternList.Count == 0) { yakuResultList.Add(YakuResultCalclator.CalcSpecialYaku(ifr, field, splited.SyuNum)); } else { //面子手の役を計算 foreach (var pattern in splited.AllHoraPatternList) { yakuResultList.Add(YakuResultCalclator.CalcNormalYaku(pattern, ifr, field, splited.SyuNum)); } } Dictionary <YakuResult, PointResult> pointResultMap = new Dictionary <YakuResult, PointResult>(); foreach (var yakuResult in yakuResultList) { //役と符から点数を計算 pointResultMap.Add(yakuResult, PointResultCalclator.AnalyzePoint(yakuResult)); } //一番点数が高い和了形の役と点数を返却 var maxMap = pointResultMap.OrderBy(e => e.Value.HoraPlayerIncome).Last(); HoraResult maxResult = new HoraResult(); maxResult.yakuResult = maxMap.Key; maxResult.pointResult = maxMap.Value; return(maxResult); }