private void AddNeighbours(HyperCube currentCube) { foreach (var neighbourPosition in currentCube.Position.Neighbours()) { var neighbour = currentCube.Neighbour(neighbourPosition); if (neighbour == null) { var newCube = new HyperCube(Cubes) { Position = neighbourPosition }; Cubes.Add(newCube.Position.ToString(), newCube); } } }
public void FillStart(IEnumerable <HyperPosition> activeCubes) { foreach (var position in activeCubes) { var cube = new HyperCube(Cubes) { Position = position }; cube.IsActive.Add(0, true); Cubes.Add(position.ToString(), cube); } var keys = Cubes.Keys.ToArray(); foreach (var CubePosition in keys) { var currentCube = Cubes[CubePosition]; AddNeighbours(currentCube); } }