Esempio n. 1
0
 public Cube(string input)
 {
     using (StringReader sr = new StringReader(input))
     {
         string line;
         int    z = 0;
         int    y = 0;
         while ((line = sr.ReadLine()) != null)
         {
             for (int x = 0; x < line.Length; x++)
             {
                 char c = line[x];
                 if (c == '.')
                 {
                 }
                 if (c == '#')
                 {
                     Point4d p = new Point4d(x, y, z, 0);
                     Active.Add(p);
                 }
             }
             y++;
         }
     }
 }
Esempio n. 2
0
        private List <Point> GetNeighbours4d(Point4d p)
        {
            List <Point> ret = new List <Point>();

            for (int z = -1; z < 2; z++)
            {
                for (int y = -1; y < 2; y++)
                {
                    for (int x = -1; x < 2; x++)
                    {
                        for (int w = -1; w < 2; w++)
                        {
                            if (z != 0 || y != 0 || x != 0 || w != 0)
                            {
                                ret.Add(new Point4d(p.X + x, p.Y + y, p.Z + z, p.W + w));
                            }
                        }
                    }
                }
            }
            return(ret);
        }