In any case, writing such an algorithm is a huge task that requires a lot of time and dedication from the developer.
But if the goal is to "play better than it plays now" - it's not difficult.
Even just changing the build order can lead to a significant improvement.