Write a function called check_surrounds with 4 inputs:
dim (a positive integer)
grid (a 2D numerical array containing only 1s and 0s of size dimxdim).
i (a positive integer between 1 and dim)
j (a positive integer between 1 and dim)
The variable dim is used to represent the number of rows/columns in a square grid in the game
minesweeper. The variable grid has a 1 in positions containing a mine and a 0 everywhere else. The
variables i and j represent the row and column respectively that the function is assessing. The function
should have one output called number. The output number should be an integer representing the
number of mines that exist in all elements adjacent to (i,j) including diagonally adjacent.
I don’t know how to write this code
can anyone help to do this?