int[,] a = new int[RowNum, ColumnNum];
string testStr = asteroidInfo.De_matrix;
char[] StrCharArray = testStr.ToCharArray();
for (int i = 0; i < RowNum; i++) { //0(N^2) TIME COMPLEXITY
for (int j = 0; j < ColumnNum; j++) {
a[i, j] = StrCharArray[i * 3 + j];
}
}
//According to the value of 1 or 0, to change the boxview's background color.
for (int i = 0; i < RowNum; i++) {
for (int j = 0; j < ColumnNum; j++) { // 0(N^2)
BoxView boxView = new BoxView {
BackgroundColor = StrCharArray[i * 3 + j].ToString().Equals("0") ? Color.White : Color.Black
};
MyGrid.Children.Add(boxView, j, i);
}
}
