Tic Tac Toe with AI using the Minimax algorithm. This was written in R for a final project in a college course.
I suggest using R-Studio to run the program.
The Minimax Algorithm is a recursive algorithm used to make decisions that lead to maximize the minimum "cost/score" according to some heuristic/evaluation function.
The minimax
function is defined and implemented on line 183. You can modify the depth
of the algorithm to make the AI
smarter. The higher the depth the further into the game the AI will look before making a decision. You can modify the depth on
line 171.
Have fun!