Here's something that I try to follow when programming AIs.
Create a set of "personalities", that is, ways in which you might expect the computer player to act. Have their actions conform to these. For instance, in a card game, you might have 3 personalities: aggressive, defensive and moderate.
Next, when it gets to the computer player's turn, randomly choose an action that conforms to the player's personality, and make sure the action is also in a list of sensible things to do.
So the logic comes down to this:
1- Based on the situation, what is a list of sensible actions to take?
2- Based on my personality, what actions from the above list would I choose?
3- Randomly choose one of these, then do it!