if its a block orientated 2d field, its simple.

1: Walk forward
2: if Path = blocked (current tile + 1) then
3: Search for new dir, except the one you came from.
3.1: If there are no valid directions, follow your path back
4: Walk forward
1: start over at step 1

I once made a pacman clone with that sort of AI. 1 ghost tried to follow the player on the X-axis, 1 on the Y-axis en the other 2 just randomly walked around.