Ejemplo n.º 1
0
        public void CheckIfTheCellsDontHaveBomb(GraphicCell[,] cell, IJ ij) //אם התאים ידועים שלא יכול להיות בהם פצצה אז סמן אותם
        {
            int i     = ij.getI();
            int j     = ij.getJ();
            int giveI = i; //i שהפעולה מביאה
            int giveJ = j; //j שהפעולה מביאה
            int mone  = 0;

            for (int k = i - 1; k <= giveI + 1; k++)
            {
                for (int f = j - 1; f <= giveJ + 1; f++)
                {
                    if (cell[k, f].IsShown == true || CheckIfMaximumBombShown(cell, ij) == true)
                    {
                        cell[k, f].BombCantBeOnTheCell = true;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public List <Stack <GraphicCell> > CheckTheCellsNumbersAndGetInToList(GraphicCell[,] cell) //עוברת על כל הלוח וכאשר היא מגיעה למספר היא מכניסה את התאים מסביבו שיכולים להיות פצצה לתוך מחסנית
        {
            IJ ijHelp;
            List <Stack <GraphicCell> > listArrCell = new List <Stack <GraphicCell> >();
            Stack <GraphicCell>         stackOptimalBombCells;

            for (int i = 1; i <= 16; i++)
            {
                for (int j = 1; j <= 16; j++)
                {
                    if (cell[i, j].IsShown == true && cell[i, j].getStatus() == GraphicCell.Status.Number)
                    {
                        stackOptimalBombCells = new Stack <GraphicCell>();
                        ijHelp = new IJ(i, j);
                        listArrCell.Add(PushOptimalicCellsInToStack(cell, ijHelp, stackOptimalBombCells));//מכניס תאים אופטימלים לתוך מחסנית
                    }
                }
            }
            return(listArrCell);
        }
Ejemplo n.º 3
0
        public Stack <GraphicCell> PushOptimalicCellsInToStack(GraphicCell[,] cell, IJ ij, Stack <GraphicCell> stackOptimalBombCells)//פעולה שמקבלת תא ומכניסה למחסנית את התאים שיכולים להיות פצצה
        {
            int i     = ij.getI();
            int j     = ij.getJ();
            int giveI = i;
            int giveJ = j;

            for (int k = i - 1; k <= giveI + 1; k++)
            {
                for (int f = j - 1; f <= giveJ + 1; f++)
                {
                    if (k != 0 && f != 0 && cell[k, f].IsShown == false && cell[k, f].IsFlagShow == false && cell[k, f].BombCantBeOnTheCell == false)
                    {
                        cell[k, f].bUsedOptimalBombCell = true;
                        stackOptimalBombCells.Push(cell[k, f]);
                    }
                }
            }
            return(stackOptimalBombCells);
        }
Ejemplo n.º 4
0
        public bool CheckIfMaximumBombShown(GraphicCell[,] cell, IJ ij) //בודק האם מספר הפצצות המקסימלי ליד מספר התגלו
        {
            int i     = ij.getI();
            int j     = ij.getJ();
            int giveI = i; //i שהפעולה מביאה
            int giveJ = j; //j שהפעולה מביאה
            int mone  = 0;

            for (int k = i - 1; k <= giveI + 1; k++)
            {
                for (int f = j - 1; f <= giveJ + 1; f++)
                {
                    if (cell[k, f].IsFlagShow == true)
                    {
                        mone++;
                    }
                }
            }
            if (mone == table.CheckMineNeerCell(i, j))
            {
                return(true);
            }
            return(false);
        }