public static void PrintNeighborCoords(MatrixPoint refpoint) { if (refpoint != null) { foreach (MatrixPoint p in ConnectedCellsInAGrid.GetNeighborPoints(refpoint)) { string s = string.Format("({0},{1})", p.Row, p.Col); Debug.WriteLine(s); } } }
public static void InitMatrix(int[][] matrix) { _numRows = matrix.Length; _numCols = matrix[0].Length; _matrix = new MatrixPoint[_numRows][]; for (int ii = 0; ii < _numRows; ii++) { _matrix[ii] = new MatrixPoint[_numCols]; } for (int ii = 0; ii < _numRows; ii++) { for (int jj = 0; jj < _numCols; jj++) { var p = new MatrixPoint(ii, jj, ((matrix[ii][jj] == 1) ? true : false)); _matrix[ii][jj] = p; } } }