Exemplo n.º 1
0
        public Tablero AgregarReina(Reina reina)
        {
            reinas.Add(reina);

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    if (reina.Posicion.X == i || reina.Posicion.Y == j)
                    {
                        this.posiciones[i][j].AgregarReina(reina.NumeroReina);
                    }
                    else if (Math.Abs(reina.Posicion.X - i) == Math.Abs(reina.Posicion.Y - j))
                    {
                        this.posiciones[i][j].AgregarReina(reina.NumeroReina);
                    }
                    //else if (Math.Abs(reina.Posicion.X + i) == Math.Abs(reina.Posicion.Y + j))
                    //{
                    //    this.posiciones[i][j].AgregarReina(reina.NumeroReina);
                    //}
                }
            }

            return this;
        }
Exemplo n.º 2
0
 public GenReina(int posicionX, int posicionY, int numeroReina)
 {
     this.reina = new Reina(posicionX, posicionY, numeroReina); ;
     this.Valor = reina;
     this.Nombre = "GenReina";
 }