Ejemplo n.º 1
0
        public ListaVectores FactorialValores(Vector V)
        {
            ListaVectores L = new ListaVectores(this);

            if (V.Count == 2)
            {
                L.Add(V.Clon());

                Vector v2 = V.Clon();
                IntercambioValores(v2[0], v2[1]);
                L.Add(v2);
            }
            else
            {
                for (int i = 0; i < V.Count; i++)
                {
                    Vector V2 = V.Clon();
                    V2.RemoveByIndex(i);
                    ListaVectores L2 = FactorialValores(V2);
                    for (int j = 0; j < L2.Count; j++)
                    {
                        L2[j].Insert(0, V[i]);
                        L.Add(L2[j]);
                    }
                }
            }
            return(L);
        }
Ejemplo n.º 2
0
        public ListaVectores VectoresEnCR(int Col, int Row)
        {//Devuelve una lista con los vectores de la lista this, que pasan por Col, Row
            ListaVectores R = new ListaVectores(Grilla);

            foreach (Vector V in this)
            {
                if (V.BuscarTile(Col, Row) >= 0)
                {
                    R.Add(V);
                }
            }

            return(R);
        }
Ejemplo n.º 3
0
        private ListaVectores ConvertirLista(ListaVectores L)
        {/* Sisi, perdimos la elegancia....*/
            ListaVectores LR = new ListaVectores(this);

            foreach (Vector V in L)
            {
                Vector VR = new Vector(this);
                foreach (Tiles T in V)
                {
                    TilesWN TW = new TilesWN(this, T.Col, T.Row, T.Valor);
                    VR.Add(TW);
                }
                LR.Add(VR);
            }

            return(LR);
        }
Ejemplo n.º 4
0
        public Boolean SolucionR(int Index_Azul, int Nivel)
        {
            Boolean Retorno = false;

            if (TapeTodo())
            {
                Retorno = true;
            }
            else
            if (Index_Azul < VectoresNuevos.Count)
            {
                Vector v_Azul = this.VectoresNuevos[Index_Azul];

                if (Nivel == 5)
                {
                    Nivel = 5;
                }

                foreach (Vector v_Rojo in this.WN_Vectores)
                {
                    if (Retorno)
                    {
                        break;
                    }

                    foreach (Tiles T_Rojo in v_Rojo)            //Recorro todos los Tiles Rojos
                    {
                        if (Retorno)
                        {
                            break;
                        }
                        ListaVectores listaFactorial = FactorialValores(v_Azul);
                        foreach (Vector v_Factorial in listaFactorial)
                        {
                            if (Retorno)
                            {
                                break;
                            }

                            for (int i = 63; i >= 0; i--)
                            {
                                iN++;
                                v_Factorial[0].Col = T_Rojo.Col;
                                v_Factorial[0].Row = T_Rojo.Row;
                                for (int j = 1; j <= 3; j++)
                                {
                                    v_Factorial[j].Col = v_Factorial[j - 1].Col + DicColRow[MatrizPocisiones[i, j], 0];
                                    v_Factorial[j].Row = v_Factorial[j - 1].Row + DicColRow[MatrizPocisiones[i, j], 1];
                                }
                                Vector Solucion = v_Factorial.Clon();
                                listaSoluciones.Add(Solucion);

                                if (SolucionR(Index_Azul + 1, Nivel + 1))
                                {
                                    Retorno = true;
                                    break;
                                }
                                else
                                {
                                    listaSoluciones.RemoveAt(listaSoluciones.Count - 1); //saco el ultimo
                                }
                            }
                        }
                    }
                }
            }
            ;

            return(Retorno);
        }