private static void GenHash(int[] array, int hzCount, bool isJiang) { for (int i = 0; i < _length; i++) { if (array[i] == 0) { continue; } array[i] -= 1; if (!array.Any(x => x > 4)) { int key = HuTools.CalcKey(array); Add(key, hzCount, isJiang); } if (hzCount < _maxHzCount) { GenHash(array, hzCount + 1, isJiang); } array[i] += 1; } }
private static void ParseGroup(int[] array, bool isJiang) { string key = string.Join(",", array); if (_parsedGroupDic.ContainsKey(key)) { return; } _parsedGroupDic[key] = true; if (!array.Any(x => x > 4)) { Add(HuTools.CalcKey(array), 0, isJiang); } GenHash(array, 1, isJiang); }