I'm trying to make a map like this in C#:
0 1
0 [ ]---[ ]
| |
| |
1 [ ]---[ ]
Simple grid with rooms at (0,0)
, (1,0)
, (0,1)
and (1,1)
I have tried doing this and have an example here https://dotnetfiddle.net/3qzBhy
But my output is:
[ ]|||| [ ]
I don't get why and not sure if calling .ToString()
on a StringBuilder makes it lose its formatting such as new lines.
I also had trouble finding a way to store coordinates
Public SortedList<int, int> Rooms ()
{
var roomList = new SortedList<int, int>();
roomList.Add(0,0);
roomList.Add(1,0);
//roomList.Add(0,1);
//roomList.Add(1,1);
return roomList;
}
roomList.Add(0,1)
and roomList.Add(1,1)
are duplicates because the keys 0
and 1
are already used. How can I store a list of coordinates?