To implement an AI, I think you should not try to modify your non-AI code into an AI implementation. Rather an AI based computer player mostly needs a completely different design, so I would redesign the whole 'player' code. I would for example go for machine learning. With machine learning, it can learn as it plays more and more and in some time (depending upon the algorithm and its implementation) it can surprise me.
For example an AI can record all its moves/plays (in a database) and draw a conclusion deciding its move the next time similar situation arises, based on statistics of successful moves.