Dev.to WebDev ๐Ÿ›  Dev ๐Ÿ‘ 1 ๐Ÿ“– 2 min read

Real game AI, not a chatbot: why these opponents don't use an LLM

Syndicated from the original on lkforge.com. The engines are playable in your browser at lkforge.com/games; the harness that produced these numbers is public and seeded. Every "AI" in a product now seems to mean a larg

Syndicated from the original on lkforge.com. The engines are playable in your browser at lkforge.com/games; the harness that produced these numbers is public and seeded.

Every "AI" in a product now seems to mean a large language model. The AI that plays against you on my site doesn't โ€” it's classical game-tree search: minimax, expectimax, breadth-first search. That's a deliberate engineering choice, and it's the difference between an opponent that's provably correct and instant and one that's plausible and slow.

The core point

My tic-tac-toe engine returns a provably-optimal move in about 0.3 ms, on your device, with zero network calls โ€” and it has lost 0 of 1,200 test games. Those are properties a language model, by construction, cannot offer: determinism, a correctness proof, and sub-frame latency without a server.

"Why not just use an LLM?"

Fair question in 2026 โ€” you could prompt a model with the board and ask for a move. The reason I don't: a language model is trained to predict the next token of text, not to search a game tree. It can explain tic-tac-toe strategy fluently and still play a losing move, because fluent text and optimal play are different objectives. Winning a solved game is a search problem, and we already have exact, fast algorithms for it.

The three engines โ€” minimax + alpha-beta for tic-tac-toe, expectimax for 2048, and BFS for Color Lines โ€” are textbook, deterministic, and run in well under a millisecond in a browser tab.

Search vs. a language model, point by point

Game-tree search (mine) A language model
Decides a move by searching the tree of legal positions predicting likely next tokens
Correctness provable at full depth none โ€” fluent โ‰  optimal
Same board โ†’ same move (deterministic) varies with sampling/phrasing
Latency sub-millisecond, on-device a network round-trip
Needs a server no yes

Every row is an architectural difference โ€” how each system decides โ€” not a quoted benchmark. The only measured numbers here are mine.

The payoff: a strength number you can actually pin down

Because the engines are deterministic, I can put an exact figure on how strong they are โ€” run the shipped code headlessly, hundreds of times, and count. That's far harder for a model whose output shifts with sampling and phrasing.

2048 solver, 250 self-play games: 69.6% of games reach the 2048 tile, 30% reach 4096, and none of the 250 reached 8192 โ€” the honest ceiling of a corner-snake expectimax search at ~0.5 ms/move. A number, with error bars you could compute, precisely because the same board always drives the same search.

Tic-tac-toe is the cleaner case: full-depth minimax is provably optimal, so "unbeatable" is a theorem, not a vibe. Across 1,200 self-play games (1,000 vs random, 200 vs a perfect copy) it lost none. Alpha-beta keeps full depth cheap: 36,528 nodes instead of 549,945 at the opening move โ€” a 93% cut โ€” in about 0.3 ms.

The right tool, not the trendy one

None of this is anti-LLM. Language models are extraordinary at language โ€” and a couple of the tools on my site that are genuinely language tasks could use one. But a board game with fixed rules and a finite tree is exactly the problem classical search was invented for.

Full write-up with charts: *lkforge.com/blog/game-ai-not-llms*. Related: Six Games, Three Classic Algorithms ยท Minimax & Alpha-Beta, Visualized ยท and the companion experiment, We Asked ChatGPT and Grok to Benchmark Our Game AI.

๐Ÿ“ฐ Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.