I'm still looking for how to implement a walking non-player character which I think is on-topic. I don't really think that the question should have been closed, or that it can be improved for reopening. I need a good algorithm for NPC AI.
Step 1, answer the question, what have you tried.
You should fully delineate what you want your AI to do to the best of your ability, solve all the problems you think you can solve, and only then come to us when you have something specific that you need help with.
As is, it doesn't seem like you have tried anything.