Minimax
Score a position by assuming both players play perfectly: minimax, a best-move picker, a fix that makes it win fast instead of toying with you, a memo that solves the whole game in 5,478 positions, and a tic-tac-toe opponent you cannot beat.
Open it in the simulator