Question: suppose there is a n * n 2 d array, create a method that finds the neighboor of one particular point in the array, basic

suppose there is a n*n 2d array, create a method that finds the neighboor of one particular point in the array, basic requirement is in the images belowCells
Each cell can be in one of two states, alive or dead, and it has 8 neighboring cells which are the cells that are horizontally, vertically, or diagonally
adjacent. The figure below exemplifies neighboring cells on a game board of 44 cells.
Cell at row 2, column 1 neighbors:
Vertical: (1,1),(3,1)
Horizontal: (2,0),(2,2)
Diagonal: (1,0),(1,2),(3,0),(3,2)
Cell at row 1, column 3 neighbors:
Vertical: (0,3),(2,3)
Horizontal: (1,2),(1,0)
Diagonal: (0,0),(0,2),(2,0),(2,2)
Cell at row 0, column 0 neighbors:
Vertical: (1,0),(3,0)
Horizontal: (0,1),(0,3)
Diagonal: (1,1),(1,3),(3,1),(3,3)
 suppose there is a n*n 2d array, create a method that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!