Hello. The problem is the following, there is a map(like the picture). We need to build an adjacency matrix where row 1 is the cell where there is a monster. What kind of algorithm it can be implemented?

asked April 3rd 20 at 17:31

1 answer

answered on

Solution

As "portals" is not provided, in any cell you can get a maximum of 4 neighbors.

Number of cells, each go around, count how many of the four neighbors are available – not a wall, not the edge of the map.

Number of cells, each go around, count how many of the four neighbors are available – not a wall, not the edge of the map.

Damn, everything just happened. Thank you! - jordon_Haag commented on April 3rd 20 at 17:36

Find more questions by tags AlgorithmsGraphsMathematical matrix