Esempio n. 1
0
        public int checkblooms(bool repass)
        {
            Lista nodosMFD = new Lista(); //Centros que están marcados para ser eliminados

            for (int i = 0; i < this.Listanodos.Largo; i++)
            {
                Celda celda = (Celda)Listanodos.buscar(i);
                if (celda.rodeada() == true)
                {
                    nodosMFD.Add(celda);
                    if (!repass)
                    {
                        counters.bloomcount++;
                    }
                    else
                    {
                        counters.chaincount++;
                    }
                }
            }
            for (int i = 0; i < nodosMFD.Largo; i++)
            {
                Celda celda = (Celda)nodosMFD.buscar(i);
                celda.boom();
                celda.ptipo  = null;
                celda.pcolor = null;
                opinterfaz.UI.DeleteHex(celda.py, celda.px);
            }
            return(nodosMFD.Largo);
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        public void OpenFile(string path) //Armar todas las estructuras, y luego ir presentandolas
        {
            Console.WriteLine("55");
            XmlDocument xDoc = new XmlDocument();

            try
            {
                xDoc.Load(path);
                this.reload = true;
            }
            catch (ArgumentException)
            {
                Console.WriteLine("ERROR - error 00002");
                return;
            }
            XmlNodeList dat = xDoc.SelectNodes("//stageList/stage");

            //Asigancion de nodos a sus posiciones iniciales...
            foreach (XmlNode stage in dat) //Leer etapas, crear una estructura hex para cada etapa, se cargan en una lista, luego se cargan individualmente
            {
                int                     i         = 0;
                XmlNodeList             Compstage = stage.ChildNodes;
                XmlNodeList             pushList  = Compstage[2].ChildNodes;
                LibreriaT3.PetalColor[] tmppushes = new LibreriaT3.PetalColor[pushList.Count];
                //Cargando los pushes
                #region
                foreach (XmlNode push in pushList)
                {
                    switch (push.Attributes[0].Value)
                    {
                    case "blue":
                        tmppushes[i] = LibreriaT3.PetalColor.Blue;
                        break;

                    case "pink":
                        tmppushes[i] = LibreriaT3.PetalColor.Pink;
                        break;

                    case "green":
                        tmppushes[i] = LibreriaT3.PetalColor.Green;
                        break;

                    case "orange":
                        tmppushes[i] = LibreriaT3.PetalColor.Orange;
                        break;

                    default:
                        Console.WriteLine("[!] No se reconoció un pushpetal en el XML");
                        break;
                    }
                    i++;
                }
                #endregion
                Etapa tempetapa = new Etapa(int.Parse(stage.Attributes[1].Value), stage.Attributes[0].Value, Compstage[3].ChildNodes[0].Attributes[0].Value, tmppushes);
                etapas.Add(tempetapa);
                XmlNodeList petalList = Compstage[0].ChildNodes;
                //Cargando los petalos
                #region
                foreach (XmlNode petal in petalList)
                {
                    int   bx       = int.Parse(petal.Attributes[2].Value); //d=x
                    int   by       = int.Parse(petal.Attributes[1].Value); //h=y
                    Celda celdatmp = tempetapa.Listanodos.buscar(bx, by);
                    switch (petal.Attributes[0].Value)
                    {
                    case "bluePetal":
                        celdatmp.pcolor = LibreriaT3.PetalColor.Blue;
                        celdatmp.ptipo  = LibreriaT3.PetalType.Normal;
                        break;

                    case "greenPetal":
                        celdatmp.pcolor = LibreriaT3.PetalColor.Green;
                        celdatmp.ptipo  = LibreriaT3.PetalType.Normal;
                        break;

                    case "pinkPetal":
                        celdatmp.pcolor = LibreriaT3.PetalColor.Pink;
                        celdatmp.ptipo  = LibreriaT3.PetalType.Normal;
                        break;

                    case "orangePetal":
                        celdatmp.pcolor = LibreriaT3.PetalColor.Orange;
                        celdatmp.ptipo  = LibreriaT3.PetalType.Normal;
                        break;

                    case "bomb":
                        celdatmp.ptipo  = LibreriaT3.PetalType.Explosive;
                        celdatmp.pcolor = null;
                        break;

                    case "rasho":
                        celdatmp.ptipo  = LibreriaT3.PetalType.Lightning;
                        celdatmp.pcolor = null;
                        break;

                    case "gravity":
                        celdatmp.ptipo  = LibreriaT3.PetalType.Gravity;
                        celdatmp.pcolor = null;
                        break;
                    }
                }
                #endregion
                XmlNodeList cellList = Compstage[1].ChildNodes;
                //Cargando las celdas especiales
                #region
                foreach (XmlNode celda in cellList)
                {
                    int   by       = int.Parse(celda.Attributes[2].Value);
                    int   bx       = int.Parse(celda.Attributes[1].Value);
                    Celda celdatmp = tempetapa.Listanodos.buscar(bx, by);
                    switch (celda.Attributes[0].Value)
                    {
                    case "ArrowS":
                        celdatmp.celdatipo = LibreriaT3.CellType.ArrowS;
                        break;

                    case "ArrowNE":
                        celdatmp.celdatipo = LibreriaT3.CellType.ArrowNE;
                        break;

                    case "ArrowNW":
                        celdatmp.celdatipo = LibreriaT3.CellType.ArrowNW;
                        break;

                    case "ArrowSE":
                        celdatmp.celdatipo = LibreriaT3.CellType.ArrowSE;
                        break;

                    case "ArrowSW":
                        celdatmp.celdatipo = LibreriaT3.CellType.ArrowSW;
                        break;

                    case "ArrowN":
                        celdatmp.celdatipo = LibreriaT3.CellType.ArrowN;
                        break;

                    case "PortalO":
                        celdatmp.celdatipo = LibreriaT3.CellType.PortalO;
                        tempetapa.portalO  = celdatmp;
                        break;

                    case "PortalB":
                        celdatmp.celdatipo = LibreriaT3.CellType.PortalB;
                        tempetapa.portalB  = celdatmp;
                        break;

                    case "Hole":
                        celdatmp.celdatipo = LibreriaT3.CellType.Hole;
                        break;
                    }
                }
                #endregion
            }
            this.mapacargado = true;
        }
Esempio n. 4
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
 }