Пример #1
0
 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);
         }
     }
 }
Пример #2
0
        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);
            }
        }