Exemplo n.º 1
0
        public bool VerificarOperacion(int[,] tablero, int num, int coordenadaX, int coordenadaY)
        {
            Figura fig       = BuscarFigura(coordenadaX, coordenadaY);
            int    operacion = fig.GetOperacion();
            int    acumulado = fig.GetAcumulado();
            int    meta      = fig.GetNumMeta();

            if (operacion == 1)
            {
                if (fig.GetTipo() != "solo")
                {
                    int totalSuma = acumulado + num;
                    if ((totalSuma <= meta) && (fig.GetOcupado() < 3))
                    {
                        return(true);
                    }

                    if ((totalSuma == meta) && (fig.GetOcupado() == 3))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                int totalMul = acumulado * num;
                if ((totalMul <= meta) && (fig.GetOcupado() < 1))
                {
                    return(true);
                }

                if ((totalMul == meta) && (fig.GetOcupado() == 1))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemplo n.º 2
0
        public void ImprimirOperaciones()
        {
            int cont = 0;

            while (ListaFiguras[cont] != null)
            {
                Figura f         = ListaFiguras[cont];
                int    operacion = f.GetOperacion();
                string numMeta   = f.GetNumMeta().ToString();
                if (operacion == 1)
                {
                    Console.WriteLine(numMeta + "+" + " ; ");
                }
                else
                {
                    Console.WriteLine(numMeta + "x" + " ; ");
                }
                cont++;
            }
        }