public static LifeNodeBase InitSpace(int dimension, InitLeaf initFunc) { if (!Utils.IsPowerOfTwo(dimension)) { throw new InvalidOperationException("dimension must be a power of 2"); } if (dimension == 2) { return(initFunc()); } LifeNodeBase subNode1 = LifeNode.InitSpace(dimension / 2, initFunc); LifeNodeBase subNode2 = LifeNode.InitSpace(dimension / 2, initFunc); LifeNodeBase subNode3 = LifeNode.InitSpace(dimension / 2, initFunc); LifeNodeBase subNode4 = LifeNode.InitSpace(dimension / 2, initFunc); return(LifeNode.CreateNode(subNode1, subNode2, subNode3, subNode4)); }
public static LifeNodeBase InitSpace(int dimension, InitLeaf initFunc) { if (!Utils.IsPowerOfTwo(dimension)) throw new InvalidOperationException("dimension must be a power of 2"); if (dimension == 2) return initFunc(); LifeNodeBase subNode1 = LifeNode.InitSpace(dimension / 2, initFunc); LifeNodeBase subNode2 = LifeNode.InitSpace(dimension / 2, initFunc); LifeNodeBase subNode3 = LifeNode.InitSpace(dimension / 2, initFunc); LifeNodeBase subNode4 = LifeNode.InitSpace(dimension / 2, initFunc); return LifeNode.CreateNode(subNode1, subNode2, subNode3, subNode4); }