Suppose we have a 2D grid, divided by cells, and that we assign people to each cell. Each person has 4 neighbors, one in the cell above, another in the cell below, and neighbors in the cells to the left and to the right, respectively. Then, let each person in its cell be assigned a random number. I then want each person in its cell to look at what their neighbors assigned number is, and out of the 4 neighbors that they choose the max of that group of people. I want to do this for all cells. Lets say we had a square divided into 9 cells.
I am trying to replicate the results of a paper (link provided below), but with an easier structure (because I dont know how to do this in Mathematica). The authors converted their 2D grid into a torus, so that those cells in the edges of the 2D space can also have four neighbors (a more detailed explanation is on the link provided below, page 5, title 2.2).
How could I ask Mathematica to compute the max for each cell's neighbors?