I don't really know about programming, and nothing about AI, but I suspect you'd need a script of sorts. Before deciding what to build, make sure the new construction won't put you into negative food or public order. If it's below a certain threshold, built a new or increase an old source, then upgrade the other building.
Bookmarks