public bool CheckCellValidity(Cell cell)
        {
            int count = 0;

            // Row
            foreach (var c in GetRowOfCell(cell))
            {
                if (c.Value == cell.Value) count++;
                if (count > 1) return false;
            }

            // Column
            count = 0;
            foreach (var c in GetColumnOfCell(cell))
            {
                if (c.Value == cell.Value) count++;
                if (count > 1) return false;
            }

            // Box
            count = 0;
            foreach (var c in cell.Box.Cells)
            {
                if (c.Value == cell.Value) count++;
                if (count > 1) return false;
            }

            return true;
        }
        private void InitializeTable()
        {
            output = new int[27, 27];
            table = new Table();
            boxes = new List<Box>();

               // for (int i = 0; i < 9; i++) boxes.Add(new Box());

            for (int y = 0; y < 9; y++)
            {
                List<Cell> row = new List<Cell>();
                Box tempBox = new Box();
                for (int x = 0; x < 9; x++)
                {
                    List<int> candidate = new List<int>();
                    Cell cell = new Cell(x, y, (int)((x + 1) * (y + 1)) % 9);

                    for (int i = 1; i < 10; i++)   candidate.Add(i);

                    cell.Candidates = candidate;
                    row.Add(cell);

                    int boxIndex = (y / 3) + (x / 3) * 3;
                    tempBox.Cells.Add(cell);
                }

                foreach (var cell in row)
                {
                    cell.Box = tempBox;
                }

                table.Cells.Add(row);
            }
            CreateOutput();
            Iteraction();
            CreateOutput();
        }
 /**
  * Utility methods
  */
 private IEnumerable<Cell> GetRowOfCell(Cell cell)
 {
     return GetRowByIndex(cell.Y);
 }
 private IEnumerable<Cell> GetColumnOfCell(Cell cell)
 {
     return GetColumnByIndex(cell.X);
 }
        public void MakeCandidatesForCell(Cell cell)
        {
            for (int value = 1; value <= 9; value++)
            {
                cell.Value = value; // testing
                if (CheckCellValidity(cell)) cell.Candidates.Add(value);
            }

            if (cell.Candidates.Count() == 1)
            {
                cell.Value = cell.Candidates[0];
                cell.Candidates.Sort();
            }
            else
            {
                cell.Value = 0;
            }
        }
 public void Heuristic_Inner_BasicStep(List<Cell> cells, Cell source)
 {
     foreach (var cell in cells)
     {
         //TODO: mi van ha benne sincs?
         cell.Candidates.Remove(source.Value);
     }
 }