#include #include #include "mpi.h" #include #include #include #define N 1200 #define max 120 #define side 10 //initialization of variables int runtime=0; int exitp = 100; int amount = 1; int nump = 9; int board = 120; int flag = -1; int arr[max][max]; int rec[max][max]; int x,y; int temp[max][max]; int rank,size; int k,tag=0; MPI_Status status; FILE* outfile; //display function, prints to grid void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0,0.0,0.0); for(x=0;x0 && arr[a-1][b]==1) count++; if(a+10 && arr[a][b-1]==1) count++; if(b+10 && a>0 && arr[a-1][b-1]==1) count++; if(b+10 && arr[a-1][b+1]==1) count++; if(a+10 && arr[a+1][b-1]==1) count++; return count; } //initializes array randomly void createArray() { int n,m; for(n=0;n3&&arr[x][y]==1) temp[x][y]=0; else if (alive<2&&arr[x][y]==1) temp[x][y]=0; else temp[x][y]=arr[x][y]; } for(x=n;x0) MPI_Send(arr,max*max,MPI_INT,rank-1,tag,MPI_COMM_WORLD); if (xs0) MPI_Send(arr,max*max,MPI_INT,rank-sqrt(size),tag,MPI_COMM_WORLD); if (ys0) { MPI_Recv(rec,max*max,MPI_INT,rank-1,tag,MPI_COMM_WORLD,&status); for (x=amount;x>=1;x--) for (y=ya;y=1;x--) for(y=ya;y0) { MPI_Recv(rec,max*max,MPI_INT,rank-sqrt(size),tag,MPI_COMM_WORLD,&status); for (y=amount;y>=1;y--) for (x=xa;x=1;y--) for (x=xa;x