public static List < List < bool >> GenerateLevel(int left, int right, int top, int bottom) {
TaskCompletionSource < List < List < bool >>> tcs = new TaskCompletionSource < List < List < bool >>> ();
List < List < bool >> WALLS = new List < List < bool >> ();
int wallsize = 100;
int rleft = (int) Math.Floor((double)(left + wallsize) / wallsize);
int rright = (int) Math.Floor((double)(right) / wallsize);
int rtop = (int) Math.Floor((double)(top + wallsize) / wallsize);
int rbottom = (int) Math.Floor((double)(bottom - wallsize) / wallsize);
List < List < bool >> cells = new List < List < bool >> ();
double total = (rright - rleft) * (rbottom - rtop);
Random random = new Random();
for (int y = rtop; y < rbottom; y++) {
List < bool > row = new List < bool > ();
for (int x = rleft; x < rright; x++) {
double rand = random.NextDouble() * 100;
row.Add(rand <= 30);
}
cells.Add(row);
Console.WriteLine(cells);
}
int _y = rtop;
int _x = rleft;
foreach(List < bool > row in cells.ToList()) {
List < bool > _row = new List < bool > ();
_x = rleft;
foreach(bool cell in row.ToList()) {
if (cell) {
row.Add(true);
}
_x++;
if (_x - rtop + 1 == row.Count) {
WALLS.Add(_row);
}
}
_y++;
}