It is unclear what you want to achieve.
I would want to know more about whether this is CUI/GUI, how the player and the crawler are going to behave, what happens when they do meet, what the zeroes stand for (empty spaces?), how the map is being updated, is it 2-D or 3-D, what libraries are you using etc.
I can only assume you are looking for a logic to implement a path finding algorithm in 2-D space, that is, how should the "dungeon crawler" chase you.
With so little information, my answer will be vague as well.
How I would do it is to have a 2-D map of the "dungeon", like so:
[ # assuming 5x5 grid
[ 0 , 0, 0, 0 , 0 ], # 'P' is where the player is
[ 'P', 0, 0, 0 , 0 ], # 'C' is where the crawler is
[ 0 , 0, 0, 0 , 0 ], # Now, call function "updateCrawler"
[ 0 , 0, 0, 0 , 0 ], # to chase the player,
[ 0 , 0, 0, 'C', 0 ], # Call "updatePlayer" to react to the crawler
This is assuming that the player and the crawler are the only ones in this dungeon.
I would save the positions of both of these to avoid calculating them every time.
And I would have 2 functions to update both things. For a player, like so:
def updatePlayer(map, player_position):
# Get the input (Keyboard? Screen? Mouse?)
map[<player y>][<player x>] = 0
if input == <go left>:
# move player left, update player position
if input == <go right>:
# move player right, update player position
if input == <go up>:
# move player up, update player position
if input == <go down>:
# move player down, update player position
map[<player y>][<player x>] = 'P'
As for the crawler, a (very) simple way would look something like this:
def updateCrawler(map, crawler_position):
map[<crawler y>][<crawler x>] = 0
if <player is above crawler>:
# move crawler up, update crawler position
if <player is left of crawler>:
# move crawler left, update crawler position
if <player is right of crawler>:
# move crawler right, update crawler position
if <player is below crawler>:
# move crawler down, update crawler position
map[<crawler y>][<crawler x>] = 'C'
Again, this depends very much on what else is in the world. Are there walls? Are there other creatures for crawler to avoid? And so on.
Hopefully, this is a starting place. I would also update my answer as and when the question is improved.