コード例 #1
0
 private void HakuHatsuChun(int offset)
 {
     for (var i = 0; i < 3; i++)
     {
         if (_arrangement.ContainsKoutsu(i + 4))
         {
             SumValue |= 0b1L << (offset + i);
         }
     }
 }
コード例 #2
0
        private static bool Matches(ArrangementGroup arrangements, Arrangement arrangement, FuConstraint constraint)
        {
            if (constraint.DoujunIndex >= 0 && !arrangement.ContainsShuntsu(constraint.DoujunIndex))
            {
                // open hands with less than 6 tiles in the arrangement can use a meld to get sanshoku
                if (arrangements.TileCount > 5 || !constraint.Open)
                {
                    return(false);
                }
            }

            if (constraint.DoukouIndex >= 0 && !arrangement.ContainsKoutsu(constraint.DoukouIndex))
            {
                // hands with less than 6 tiles in the arrangement can use a meld to get sanshoku. If closed must be ankan
                if (arrangements.TileCount > 5)
                {
                    return(false);
                }
            }

            var hasIipeikou = arrangement.Blocks.Where(b => b.IsShuntsu).GroupBy(s => s.Index).Any(g => g.Count() >= 2);

            if (arrangements.HasIipeikou && !constraint.Open && !hasIipeikou)
            {
                if (!arrangements.HasSquareType || constraint.SquareIsNotSanankou)
                {
                    return(false);
                }
            }

            if (constraint.SquareIsNotSanankou && arrangement.Blocks.Count(b => b.IsKoutsu) >= 3)
            {
                return(false);
            }

            return(true);
        }