MadonnaModel Arial!D(.2> B 6: 1 *{Game of Life on a network spatial topology} {simulation control information} METHOD Euler STARTTIME = 0 STOPTIME= 5 DT = 1 DTOUT = 1 {set dimensions of grid} begin = 1 end = 4 {limit cell values to between zero and one} limit cells >= 0 limit cells <= 1 {Initialize the cells by reading external data} init cells[begin..end,begin..end] = #cell_init(i,j) {this is a grid+1 by grid+1 csv file of starting values -- zero or one -- for the grid by grid number of actors} {input the network connections from an external file} network[begin..end^2,begin..end^2] = #network(i,j) {this is a actors+1 by actors+1 csv file of network connections of edges from actor x to actor y} {rule of the game -- proportion of neighbors who must be alive for an actor to be alive} CELL_LIVE = 0.5 {arrays and algorithms needed for data handling -- for programmers only beyond this point} {for each actor, count the number of neighbors who are are alive} temp1[begin..end^2,begin..end^2] = IF (network[i,j] = 1 and j > 1) THEN temp1[i,j-1] + 1 ELSE IF (network[i,j] = 1) THEN 11 ELSE IF (network[i,j] = 0) AND (j > 1) THEN temp1[i,j-1] ELSE 0 network_count_temp[begin..end^2] = temp1[i,end^2] {This table will be indexed 1..end^2. and each value of the array will hold the corresponding corrdinates to the grid layout. so rev_table[2] = 12..which will translate to CELL 2 is at coordinates (1,2)} temp_rev[begin..end,begin..end] = i*10 + j rev_table[begin..end^2] = temp_rev[1,i] {This code will check to see if a cell is in the CURRENT cell's network list..if yes then check to see if its alive. if yes then add 1, else do nothing} temp2[begin..end^2,begin..end^2] = IF (cells[INT(rev_table[j]/10),MOD(rev_table[j],10)] = 1) AND (j > 1) AND (network[i,j] = 1) THEN temp2[i,j-1] + 1 ELSE IF (cells[INT(rev_table[j]/10),MOD(rev_table[j],10)] = 1) AND (j = 1) AND (network[i,j] = 1) THEN 1 ELSE IF (network[i,j] = 0) AND (j = 1) THEN 0 ELSE temp2[i,j-1] status_count_temp[begin..end^2] = temp2[i,end^2] {this piece of code converts the network_count [begin X end^2] array into a 2-dimensional [begin..end,begin..end] size array} status_count[begin..end,begin..end] = status_count_temp[i + end*(j-1)] network_count[begin..end,begin..end] = network_count_temp[i + end*(j-1)] percent_alive[begin..end,begin..end] = IF network_count[i,j] > 0 THEN status_count[i,j]/network_count[i,j] ELSE 0 cell_state[begin..end,begin..end] = IF (percent_alive[i,j] >= CELL_LIVE ) THEN 1 ELSE 0 {create the reporting variable of the number of cells that are alive at each step} cell_sum = ARRAYSUM(cells[*]) {initiate cell to next state on next time step} next cells[begin..end,begin..end] = cell_state[i,j]5,A ) q  #network""?@@@@@@@AA A0A@APA`ApAA????@???@@?@?@??@????@?????AA? A????0A????@A?PA?`A?pA??A??,,>#cell_init ?@@@@???@?@@??@???I?@>@@ eulerDT?MbP?MbP?MbP?*: >Fjnr 6&B,X .Fjnr z Q,q,UAv=,-,,A, y,$B&B(B*B,9A.MAC