There is no neural network here

Let's start by clearing something up, because "AI" has become a word that mostly means "large language model" these days. The opponents on PlayVersusAI are not neural networks, and nothing here is calling out to an external model. Every opponent on this site is a classical game-tree search engine written in plain JavaScript that runs entirely inside your browser tab. Your moves never leave your device in order to be answered - the thinking happens on your own hardware, which is why the AI still works if your connection drops mid-game.

That design choice has a real trade-off. A search engine cannot develop intuition or surprise you with something creative the way a trained network can. What it can do is calculate, exhaustively and without ever getting bored or distracted. On a game like Connect 4, that turns out to be more than enough to beat almost everybody.

The core idea: minimax

Nearly every versus game on this site is driven by an algorithm called minimax. The concept is simpler than the name suggests. The engine builds a tree of possible futures: here are all the moves I could make, and for each of those, all the moves you could reply with, and for each of those, all of my responses, and so on. At the bottom of that tree, it scores each resulting position with a number - positive if it looks good for the AI, negative if it looks good for you.

Then it works backwards up the tree with one pessimistic assumption: you will always pick the move that is worst for the AI. The engine picks the move whose worst realistic outcome is the least bad. That is the "mini-max" - minimising your maximum. It is why the AI rarely falls for cheap traps; it has already assumed you will find the best reply and has planned around it.

Alpha-beta pruning: why it's fast enough

A full minimax tree is enormous. Connect 4 has seven legal moves in most positions, so looking twelve moves ahead means roughly 712 positions - about 14 billion. No browser is evaluating 14 billion positions while you wait.

Alpha-beta pruning is the shortcut that makes it practical. As the engine searches, it tracks the best score each side has been guaranteed so far. The moment a branch is proven worse than something already found, that branch is abandoned without examining the rest of it. If you have already discovered a move that wins a piece, and you start looking at a second move that immediately loses your queen, you don't need to keep reading - it's already worse. Alpha-beta does exactly that, mechanically, millions of times per second. In practice it cuts the number of positions examined from billions down to a few hundred thousand, with identical results to a full search. Nothing is lost except wasted work.

Move ordering, transposition tables, and iterative deepening

Alpha-beta only prunes well if good moves are examined first, so each engine sorts its candidate moves before searching them. Connect 4 tries centre columns first, because centre control wins games. Chess tries captures and checks first. Better ordering means more pruning, which means deeper search in the same amount of time.

A transposition table handles the fact that different move orders often reach the same position. Playing the moves A then B frequently gives the identical board to B then A. The engine stores positions it has already scored in a hash table and reuses the result instead of recalculating, which on a typical Connect 4 search saves a large fraction of the total work.

Iterative deepening means the engine searches to depth 1, then depth 2, then depth 3, and keeps going until it runs out of its time budget. This sounds wasteful - and the shallow searches technically are - but they are cheap, and each one produces a rough best-move ordering that makes the next, deeper search prune far more aggressively. It also means the engine always has a legal, reasonable move ready the instant its clock expires, instead of being caught halfway through a search with nothing to show.

Evaluation: how a position becomes a number

Search decides which futures to examine. Evaluation decides what those futures are worth, and it is where most of the per-game personality lives. When a game is fully resolved the answer is obvious - a win is a huge positive, a loss a huge negative, a draw zero. But the engine almost never searches all the way to the end of a real game, so it has to judge unfinished positions with a heuristic.

Every game on the site weighs different things:

  • Connect 4 counts open three-in-a-rows for each side, weights central columns more heavily than the edges, and specifically rewards odd/even threat squares - a well-known Connect 4 principle where which row your threat sits on determines who can actually use it.
  • Chess uses material values plus piece-square tables, so a knight in the centre scores better than one on the rim, and pawns are worth more as they advance. It also scores king safety and pawn structure.
  • Reversi deliberately ignores disc count for most of the game, because having more discs in the midgame is often a liability. It values corners enormously, penalises the squares diagonally adjacent to empty corners, and weighs mobility - how many legal moves each side has - above almost everything else.
  • Checkers counts material with kings worth substantially more than men, and adds bonuses for advancement and back-row defence.
  • Mancala scores stones banked in your store, stones still under your control, and the availability of extra-turn chains, which are often worth more than a straightforward capture.
  • Nine Men's Morris counts formed mills, near-mills, and blocked opponent pieces, since restricting movement is frequently decisive.

Games that don't use minimax

Minimax assumes both players have complete information and no dice are involved. Several games here break that assumption and need different machinery.

Battleship has hidden information, so there is no tree to search. Instead the hard AI builds a probability density map: for every remaining ship, it counts how many ways that ship could legally be placed over each unfired square, and fires at the square with the highest total. Once it scores a hit it switches to targeting mode, concentrating fire along the likely axis. This is the same technique that makes strong Battleship bots so uncomfortable to play - it is not guessing, it is fishing where the fish statistically are.

Backgammon involves dice, so the engine uses expectiminimax: it adds chance nodes to the tree that average outcomes over all 21 distinct dice rolls, weighted by probability. Because that multiplies the branching factor enormously, the backgammon AI searches shallower than the deterministic games and leans more heavily on positional evaluation - pip count, blot exposure, prime building, and anchor placement.

Crazy Eights and Blackjack involve hidden cards. Crazy Eights uses heuristics over the known state - which suits are safe to play, when to spend an eight, what the opponent's draw history implies about their hand. Blackjack's dealer follows fixed casino rules, and the optional hint system is a basic-strategy table, not a search.

Sudoku, Minesweeper, 2048, Solitaire, Snake, and Word Guess are solo games with no opponent at all. The interesting algorithm in those is generation rather than opposition: the Sudoku generator, for instance, produces a puzzle and then verifies it has exactly one solution reachable by human logic techniques at the chosen difficulty, so you are never forced to guess.

The four difficulty levels

Difficulty is not a single dial. Making an engine weaker by simply searching less deeply produces an opponent that is boring and inconsistent, so each level changes several things at once.

LevelWhat changesWho it's for
Easy Shallow search with deliberate randomness. It will spot an immediate win or block an immediate loss, but it does not plan traps and will overlook two-move threats. Learning the rules, or playing with kids
Medium Moderate depth, full evaluation, no injected mistakes. It plays consistently sound moves but will not find long forced sequences. Casual players who want a fair fight
Hard Deep search with full move ordering and transposition tables. It sees multi-move tactics and punishes loose play immediately. Experienced players
AI Training Maximum depth the time budget allows, no randomness, no mercy. In Connect 4 this is effectively solved play from the opening. Anyone who wants to be humbled

An honest note about Easy mode: it plays badly on purpose. It is not a weaker engine so much as a strong one told to occasionally pick something other than its best move. If it feels like it blundered, it did, and that is the intent.

Known limitations

We would rather tell you where the AI is weak than pretend it isn't.

  • Connect 4 on AI Training is close to unbeatable if it moves first. Connect 4 is a solved game - the first player wins with perfect play from the centre column. Going second against maximum difficulty is the honest challenge.
  • The chess engine is club-strength, not Stockfish. It handles tactics well within its search depth and knows the full rules including castling, en passant and promotion, but it has no opening book and no endgame tablebases. Strong players will out-manoeuvre it in quiet positions and in king-and-pawn endings.
  • Backgammon's shallow search shows in the doubling decisions and complex race positions. Dice multiply the tree faster than we can search it in a browser.
  • Long-term planning is limited across the board. These are fixed-depth searchers. If a winning plan takes more moves than the search horizon, the AI will not see it, which is exactly how patient positional play beats it.
  • Mobile devices search less deeply. The time budget is wall-clock based, so a slower processor genuinely produces a slightly weaker opponent. A hard-mode game on an older phone is not identical to one on a desktop.
  • The AI does not learn from you. It has no memory between games and does not adapt to your style. If you find a line that beats it, that line will keep working.

Coach mode

In the flagship games you can switch on Coach mode, which exposes what the engine is thinking rather than hiding it. Before you move, the coach runs an evaluation of your candidate options and flags whether the move you are considering keeps, improves, or throws away your advantage. After the game, the review walks the whole thing move by move and marks the point where the evaluation swung - usually a single quiet move several turns before anything visibly went wrong.

This is the same evaluation function the opponent uses, so the feedback is genuinely the engine's own opinion. It is not always right - see the limitations above - but it is consistent, and it is very good at showing you the moment a game was actually lost as opposed to the moment it felt lost.

Want the specifics for one game?

Each game's strategy guide covers how that particular AI behaves, what it is good at, and the practical lines that tend to work against it. Start with the Connect 4 guide, the Chess guide, or browse all 20 guides.