[Solved] Why the values {1, 1, 0, -1, -1, -1, 0, 1} and {0, 1, 1, 1, 0, -1, -1, -1} were chosen for dx[dir] and dy[dir]? [closed]
There are up to 8 directions you can move in from any position on the grid. The dx and dy arrays represent the x and y axis offsets of the adjacent cells. Iterating over the elements pairwise gives you: index dir x y 0 e 1 0 1 se 1 1 2 n 0 1 … Read more