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]++; } } }
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); }
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); }
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]++; } } }
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; }
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); }