Tic-tac-toe bot, Part 2: minimax, with a small game tree

Tic-Tac-Toe Minimax Algorithm in Java

In Part 1, I built a tic-tac-toe bot with a layered brain: 7 small strategies, asked one by one. It worked. I couldn’t beat it anymore. But it was hard to scale. A bigger board needs more conditions, and every new condition is one more place for things to break. It also couldn’t really look ahead. Only two of the strategies, Fork and BlockFork, thought about the next move. The rest just read the board as it is right now. ...

November 12, 2026 · 7 min · 1474 words · Hitesh Patel