Esempio n. 1
0
 private static IEnumerable<string> CreateAnalyzedSuit(int count)
 {
   var maxMelds = (14 - count) / 3;
   for (var meldCount = 0; meldCount <= maxMelds; ++meldCount)
   {
     var meldedCreator = MeldedCombinationsCreator.CreateSuitCombinationsCreator();
     var meldedCombinations = meldedCreator.Create(meldCount);
     foreach (var meldedCombination in meldedCombinations)
     {
       var m = meldCount;
       var concealedCreator = ConcealedCombinationCreator.CreateSuitCombinationsCreator();
       var combinations = concealedCreator.Create(count, meldedCombination);
       foreach (var combination in combinations)
       {
         var analyzer = new TileGroupAnalyzer(combination, meldedCombination, m, true);
         var arrangements = analyzer.Analyze();
         var arrangementsString = GetArrangementsString(arrangements);
         yield return $"{m}{string.Join("", meldedCombination.Counts)}{string.Join("", combination.Counts)}{arrangementsString}";
       }
     }
   }
 }
 private static void CheckHand(int expectedCount, IList<int> concealedTiles, IList<int> meldedTiles, int meldCount)
 {
     var allowShuntsu = concealedTiles.Count == 9;
       var concealed = new Combination(concealedTiles);
       var melded = new Combination(meldedTiles);
       var analyzer = new TileGroupAnalyzer(concealed, melded, meldCount, allowShuntsu);
       var arrangements = analyzer.Analyze().ToList();
       var hand = $"({string.Join("", concealedTiles)})({string.Join("", meldedTiles)})({meldCount})";
       var arrangementTexts = arrangements.Select(a => $"({a.JantouValue}, {a.MentsuCount}, {a.MentsuValue})");
       var message = $"hand {hand} has wrong arrangements: {string.Join("", arrangementTexts)}";
       Assert.AreEqual(expectedCount, arrangements.Count, message);
 }
Esempio n. 3
0
 private static IEnumerable<string> CreateAnalyzedHonors(int count)
 {
   var maxMelds = (14 - count) / 3;
   for (var meldCount = 0; meldCount <= maxMelds; ++meldCount)
   {
     var meldedCreator = MeldedCombinationsCreator.CreateHonorsCombinationsCreator();
     var meldedCombinations = meldedCreator.Create(meldCount);
     foreach (var meldedCombination in meldedCombinations)
     {
       var m = meldCount;
       var concealedCreator = ConcealedCombinationCreator.CreateHonorsCombinationsCreator();
       var combinations = concealedCreator.Create(count, meldedCombination);
       foreach (var combination in combinations)
       {
         var analyzer = new TileGroupAnalyzer(combination, meldedCombination, m, false);
         var arrangements = analyzer.Analyze();
         var formattedArrangements = arrangements.Select(a => CreateCompactArrangementString(a));
         var arrangementsString = string.Join("", formattedArrangements);
         yield return $"{m}{string.Join("", meldedCombination.Counts)}{string.Join("", combination.Counts)}{arrangementsString}";
       }
     }
   }
 }