public void BuildBlueRedAdjacencyMatrix() { bf_adjacency_red_blue = new int[bfOrder, bfOrder]; if (blue_red_adj_mat == null) { blue_red_adj_mat = new string[bfOrder, bfOrder]; } for (int i = 0; i < bfOrder; i++) { for (int j = 0; j < bfOrder; j++) { blue_red_adj_mat[i, j] = "0"; } } foreach (string src in bf_blue_red.Keys) { int bid = BlueRadarIds.FindIndex(x => "B" + x == src); foreach (string dest in bf_blue_red[src]) { int rid = RedRadarIds.FindIndex(x => "R" + x == dest); //TODO: remove the if condition so that field is assigned every time if (bid < bfOrder && rid < bfOrder) { bf_adjacency_red_blue[bid, rid] = 1; } } } }
//b=blue, gr=red, f=field //flat structures evolve? better seen in netlogo //first do in c# //0 to full public void init_bf_view_global() { Random r = new Random(18); int bcount = 0, rcount = 0; string bid = String.Empty; string rid = String.Empty; for (int i = 0; i < bfOrder; i++) { for (int j = 0; j < bfOrder; j++) { bid = String.Empty; rid = String.Empty; bid += bcount < 100 ? "0" : String.Empty; bid += bcount < 10 ? "0" : String.Empty; bid += bcount.ToString(); rid += rcount < 100 ? "0" : String.Empty; rid += rcount < 10 ? "0" : String.Empty; rid += rcount.ToString(); int roll = r.Next(3); if (roll == 0) { bf_global_view[i, j] = "B" + bid; BlueRadarIds.Add(bid); bcount++; } else if (roll == 1) { bf_global_view[i, j] = "R" + rid; RedRadarIds.Add(rid); rcount++; } else { bf_global_view[i, j] = " "; } } } }