Also is worth pointing out a AI has to be dumb to some extent to be enjoyable, if the AI was coded to always do the perfect action, it would always win.
This is one reason I dont like human to human gaming as I generally always lose

, whilst I enjoy single player games as typically AI can usually be beaten at least eventually.