I just wrote a Java program that cannot lose at a game of Tic-Tac-Toe. Your best hope is to tie it in a game.
You can find the full code here: github.com
It works by using the minimax algorithm. I'll be writing an article about this on my personal blog soon.
If you can look at the code and tell me what you think, I would appreciate it. Any feedback will be greatly appreciated!
from: https://dev.to//jaeheonshim/i-wrote-an-unbeatable-tic-tac-toe-ai-in-java-2g3a