Пример #1
0
        public Etapa(int radio, string name, string objetivo, LibreriaT3.PetalColor[] pushes)
        {
            this.pushes   = pushes;
            pushrestantes = pushes.Length;
            this.nombre   = name;
            this.radio    = radio;
            Listanodos    = new Lista();
            Celdabase     = new Celda(0, 0, Listanodos);
            Listanodos.Add(Celdabase);
            Celdabase.crecer(this.radio - 1);
            Celdabase.crearborde(this.radio);
            Celda dem = (Celda)Listanodos.buscar(1, 1);

            this.nobjetivo = objetivo; //Parsear esto a algo logico
            counters.obj   = objetivo;
            this.name      = nombre;
        }
Пример #2
0
 /// <summary>
 /// Este metodo solo es funcional si es llamado desde una celda base (h = 0, d = 0). En otro caso, originará una estructura erronea
 /// </summary>
 /// <param name="radio"></param>
 public void crearborde(int radio) //Creador del borde
 {
     #region
     if (radio > 0)
     {
         radio--;
         //----------
         if (NN == null)
         {
             NN           = new Celda(this.px, this.py + 1, listanodos);
             NN.celdatipo = LibreriaT3.CellType.Hole;
             listanodos.Add(NN);
         }
         //----------
         if (NW == null)
         {
             NW           = new Celda(this.px - 1, this.py + 1, listanodos);
             NW.celdatipo = LibreriaT3.CellType.Hole;
             listanodos.Add(NW);
         }
         //----------
         if (NE == null)
         {
             NE           = new Celda(this.px + 1, this.py, listanodos);
             NE.celdatipo = LibreriaT3.CellType.Hole;
             listanodos.Add(NE);
         }
         //----------
         if (SS == null)
         {
             SS           = new Celda(this.px, this.py - 1, listanodos);
             SS.celdatipo = LibreriaT3.CellType.Hole;
             listanodos.Add(SS);
         }
         //----------
         if (SW == null)
         {
             SW           = new Celda(this.px - 1, this.py, listanodos);
             SW.celdatipo = LibreriaT3.CellType.Hole;
             listanodos.Add(SW);
         }
         //----------
         if (SE == null)
         {
             SE           = new Celda(this.px + 1, this.py - 1, listanodos);
             SE.celdatipo = LibreriaT3.CellType.Hole;
             listanodos.Add(SE);
         }
         //----------
         //Asignacion direcciones a los diversos nodos CW
         SW.SE = SS;
         SS.NE = SE;
         SE.NN = NE;
         NE.NW = NN;
         NN.SW = NW;
         NW.SS = SW;
         //Asignacion de direcciones a los diversos nodos CCW
         SW.NN = NW;
         NW.NE = NN;
         NN.SE = NE;
         NE.SS = SE;
         SE.SW = SS;
         SS.NW = SW;
         //Devoluciones al nodo original
         NN.SS = this;
         NE.SW = this;
         SE.NW = this;
         SS.NN = this;
         SW.NE = this;
         NW.SE = this;
         //Órdenes de crecimiento
         NN.crearborde(radio);
         NW.crearborde(radio);
         NE.crearborde(radio);
         SE.crearborde(radio);
         SS.crearborde(radio);
         SW.crearborde(radio);
     }
     #endregion
 }