I am trying to add values to a 2 dimensional array of int[,]
The text file ConnectedCaves
contains the following data
0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0
I need to have it in the following format;
int[,] graph = new int[,]
{
{ 0,0,0,1,0,0,0 },
{ 0,0,0,1,1,0,0 },
{ 0,0,0,0,1,1,1 },
{ 1,0,0,0,1,1,0 },
{ 0,1,1,1,0,0,0 },
{ 0,0,1,1,0,0,0 },
{ 0,0,1,0,0,0,0 }
};
I haven't been able to find much on how this is done. and there fore don't have any code that would be of use to share.
Is it possible to add this as it appears in the text file to the 2 dimensional array? If not directly what would be the best approach to getting this data into the array in the format show in the text file?