Exemple #1
0
        private long FindResult(int currentLength, WallSection wallSection)
        {
            if(currentLength == length) {
                return 1;
            }

            String key = wallSection.GetKey() + currentLength;

            if (store.ContainsKey(key)) {
                return (long)store[key];
            }

            List<WallSection> children = wallSection.GetChildren();

            long result = 0;
            for (int i = 0; i < children.Count; i++) {
                result += FindResult(currentLength + 1, children[i]);
            }

            store.Add(key, result);
            return result;
        }