bool checkSafe(Reyna rP)
        {
            var Lr = new List <Reyna>(rL);


            Lr.ToString();

            for (int b = 0; b < Lr.Count; b++)
            {
                {
                    if (rP.getCol() == Lr[b].getCol())

                    {
                        return(false);
                    }

                    if (Math.Pow(rP.getRow() - Lr[b].getRow(), 2) == Math.Pow(rP.getCol() - Lr[b].getCol(), 2))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        void backTrack()
        {
            while (row < 6)
            {
                while (col < 6)
                {
                    Reyna rPos = new Reyna(col, row);            //position of queen

                    clearBitmap(bmpAnimation, Color.Transparent);
                    if (safeC)
                    {
                        ListAnim.Add(rPos);
                    }
                    else
                    {
                        ListAnim[row] = rPos;                                                                                                //row
                    }
                    for (int x = 0; x < ListAnim.Count(); x++)                                                                               //animation onboard
                    {
                        g.DrawImage(bmpQueen, ListAnim[x].getCol() * 100 + 27, ListAnim[x].getRow() * 100, bmpQueen.Width, bmpQueen.Height); //col row
                    }
                    pictureBox1.Refresh();


                    if (checkSafe(rPos))
                    {
                        button2.Enabled = true;
                        safeC           = true;
                        flag            = true;
                        rL.Add(rPos);

                        if (rL.Count() == 6)
                        {
                            MessageBox.Show("Solution Found");
                            row      = 0;
                            col      = ListAnim[0].getCol() + 1;
                            ListAnim = new List <Reyna>();
                            rL       = new List <Reyna>();

                            return;
                        }

                        break;
                    }
                    safeC = false;
                    flag  = false;
                    col++;
                }

                if (flag == false)
                {
                    row = row - 1;
                    if (row == -1)
                    {
                        MessageBox.Show("Programa terminado");
                        button2.Enabled = false;
                        break;
                    }
                    col = rL[row].getCol() + 1;

                    rL.RemoveAt(row);
                    ListAnim.RemoveAt(row);
                }
                else
                {
                    col = 0;
                    row++;
                }
            }
        }