On the previous code, I could only play as player vs player game. Since I got the request to make it enable to play as a player vs computer, I had to update the logic.
Here is the comparison of the blueCard function for example. The previous version is the upper one.
There is no big difference between the two of them. What I could do for the update was to create a vector to store which position options are available for the AI. Then, I created a new function called "AiMakingChoice" function.
AiMakingChoice function
I could pass the vector I mentioned earlier to this function, and then randomly choose among the available choices. The function will return one of those choices, and this is how computer can play the game.
On the previous code, I could only play as player vs player game. Since I got the request to make it enable to play as a player vs computer, I had to update the logic.
Here is the comparison of the blueCard function for example. The previous version is the upper one.
There is no big difference between the two of them. What I could do for the update was to create a vector to store which position options are available for the AI. Then, I created a new function called "AiMakingChoice" function.
AiMakingChoice function
I could pass the vector I mentioned earlier to this function, and then randomly choose among the available choices. The function will return one of those choices, and this is how computer can play the game.