예제 #1
0
        private static void reSplit(int start, int[] syu, ref List <Tartsu> work, ref List <HoraPattern> resultList)
        {
            if (syuIsZero(syu))
            {
                HoraPattern result = new HoraPattern(work);
                resultList.Add(result);
                return;
            }

            for (int i = start; i < MJUtil.LENGTH_SYU_ALL; i++)
            {
                if (syu[i] >= 3)
                {
                    syu[i] -= 3;
                    Tartsu ts = new Tartsu(MJUtil.TartsuType.ANKO, i);
                    work.Add(ts);
                    reSplit(i, syu, ref work, ref resultList);
                    work.Remove(ts);
                    syu[i] += 3;
                }
                if ((i <= 24) && ((syu[i] >= 1) && (syu[i + 1] >= 1) && (syu[i + 2] >= 1)))
                {
                    syu[i]--;
                    syu[i + 1]--;
                    syu[i + 2]--;
                    Tartsu ts = new Tartsu(MJUtil.TartsuType.ANSYUN, i);
                    work.Add(ts);
                    reSplit(i, syu, ref work, ref resultList);
                    work.Remove(ts);
                    syu[i]++;
                    syu[i + 1]++;
                    syu[i + 2]++;
                }
            }
        }
예제 #2
0
        private static List <HoraPattern> split(int[] syu)
        {
            List <Tartsu>      work       = new List <Tartsu>();
            List <HoraPattern> resultList = new List <HoraPattern>();
            int start = 0;

            for (int i = 0; i < MJUtil.LENGTH_SYU_ALL; i++)
            {
                if (syu[i] >= 2)
                {
                    syu[i] -= 2;
                    Tartsu ts = new Tartsu(MJUtil.TartsuType.HEAD, i);
                    work.Add(ts);
                    reSplit(start, syu, ref work, ref resultList);
                    work.Remove(ts);
                    syu[i] += 2;
                }
            }
            return(resultList);
        }
예제 #3
0
 public HoraPattern(List<Tartsu> horaPatternTartsuList)
 {
     TartsuList = new List<Tartsu>(horaPatternTartsuList);
     WithoutHeadTartsuList = TartsuList.Where(e => e.TartsuType != MJUtil.TartsuType.HEAD).ToList();
     Head = TartsuList.First(e => e.TartsuType == MJUtil.TartsuType.HEAD);
 }
예제 #4
0
        private static void reSplit(int start, int[] syu, ref List<Tartsu> work, ref List<HoraPattern> resultList)
        {

            if (syuIsZero(syu))
            {
                HoraPattern result = new HoraPattern(work);
                resultList.Add(result);
                return;
            }

            for (int i = start; i < MJUtil.LENGTH_SYU_ALL; i++)
            {

                if (syu[i] >= 3)
                {
                    syu[i] -= 3;
                    Tartsu ts = new Tartsu(MJUtil.TartsuType.ANKO, i);
                    work.Add(ts);
                    reSplit(i, syu, ref work, ref resultList);
                    work.Remove(ts);
                    syu[i] += 3;
                }
                if ((i <= 24) && ((syu[i] >= 1) && (syu[i + 1] >= 1) && (syu[i + 2] >= 1)))
                {
                    syu[i]--;
                    syu[i + 1]--;
                    syu[i + 2]--;
                    Tartsu ts = new Tartsu(MJUtil.TartsuType.ANSYUN, i);
                    work.Add(ts);
                    reSplit(i, syu, ref work, ref resultList);
                    work.Remove(ts);
                    syu[i]++;
                    syu[i + 1]++;
                    syu[i + 2]++;
                }

            }
        }
예제 #5
0
 private static List<HoraPattern> split(int[] syu)
 {
     List<Tartsu> work = new List<Tartsu>();
     List<HoraPattern> resultList = new List<HoraPattern>();
     int start = 0;
     for (int i = 0; i < MJUtil.LENGTH_SYU_ALL; i++)
     {
         if (syu[i] >= 2)
         {
             syu[i] -= 2;
             Tartsu ts = new Tartsu(MJUtil.TartsuType.HEAD, i);
             work.Add(ts);
             reSplit(start, syu, ref work, ref resultList);
             work.Remove(ts);
             syu[i] += 2;
         }
     }
     return resultList;
 }
예제 #6
0
 public HoraPattern(List <Tartsu> horaPatternTartsuList)
 {
     TartsuList            = new List <Tartsu>(horaPatternTartsuList);
     WithoutHeadTartsuList = TartsuList.Where(e => e.TartsuType != MJUtil.TartsuType.HEAD).ToList();
     Head = TartsuList.First(e => e.TartsuType == MJUtil.TartsuType.HEAD);
 }