I need a little insight on how I can easily check if an object is within a certain range of another object in a 10x10 grid. In my game of 'The Wolf and the 5 Goats', I need to move a goat away from the wolf when a check is performed and finds a goat within the striking distance of the wolf. The wolf's distance changes after each move, so let's say the movement of the wolf is three squares. I need to check the squares around the goat to see if it's in range.

0000000000

0w00000000

000g000000 ( As shown here, the w is 3 moves away from g. 2 to the right, 1 down, or 1 down, 2 to the right )

0000000000

... to row 10

The goats location is kept in an array. p[1,1] is the row, and p[1,2] is the column. So the goat is at row, 3, column 4, and the wolf at row 2, column 2, which I keep track of in p[0,1] and p[0,2]. Any ideas?

Thanks...

whitenite1