Help with Tank game AI

I’m making a tank game with AS2 OOP, and I’m having problems with the AI. No, this isn’t that game where you aim your canon, set the velocity, and try to hit your opponent. This is a real-time top-down-view game, where you control the tank, rotate the turret, and try to kill the other guy.

2-Player mode works just fine, but I can’t get the 1-Player mode’s enemy tank to move around realistically, without running into walls and staying there. I do have it so when you get close enough, the turret follows you, but the tank doesn’t do anything.

Any input would be appreciated.

Thanks for reading.

where are the walls?
I mean are the walls positionsed around the field like a kind of frame or are there walls on the field too?

if there is just a frame of walls there should be no problem. just make the tank turn if it is <ymin, >ymax, <xmin or >xmax

if there are some walls on the field I suggest using some pathfinding in combination with a tile based engine. else it will be quite difficult and cpu intensive.