Interactive · Classic Game AI

Game AI Visualizer

The computer opponents in LK Forge's games don't call a chatbot — they run textbook search algorithms. Here are three of them, live and watchable: minimax with alpha-beta pruning, expectimax, and breadth-first search. Play with each and watch the numbers move.

Minimax with alpha-beta pruning

You are X. Every time you move, O searches the whole game tree to the end, assuming you'll play perfectly too, and picks the move with the best guaranteed result. On Hard, that makes it unbeatable — the best you can force is a draw. Watch how many positions it evaluates, and how many alpha-beta pruning lets it skip.

0evaluated (α-β)
0full search
0%pruned away

Three algorithms, three kinds of game

Each panel is a stripped-down version of something a real LK Forge game does. Minimax and alpha-beta run the unbeatable Tic-Tac-Toe and, in richer form, chess and Connect 4. Expectimax is what lets the 2048 solver plan through random tile spawns. Breadth-first search finds valid and shortest paths in puzzles like Color Lines — and its weighted cousins Dijkstra and A* get their own Pathfinding Visualizer. None of them is a language model — they're deterministic search over the actual game state. The full write-up is Six Games, Three Classic Algorithms, and on why that isn't an LLM.

Common questions

What is minimax with alpha-beta pruning?
Minimax is a game-tree search: one player maximises the score and the opponent minimises it, so the algorithm assumes best play from both sides and picks the move with the best guaranteed outcome. Alpha-beta pruning skips branches that cannot change the decision, cutting the number of positions searched — often by more than half — without changing the answer. On the visualizer's 3x3 Tic-Tac-Toe you can see both counts: positions evaluated with pruning versus the full search.

How is expectimax different from minimax?
Minimax assumes an adversary who always picks the worst outcome for you. Expectimax replaces that adversary with chance: at a chance node it takes the probability-weighted average of the outcomes rather than the minimum. That is the right model when randomness, not an opponent, decides what happens next — for example the random tile that appears in 2048. The visualizer shows a chance node fanning out over the six faces of a die and averaging them. Slide the turn total and the recommendation flips at 20 — the classic "hold at 20" threshold falls straight out of the averages.

Why use breadth-first search for a shortest path?
On an unweighted grid — every step costs the same — breadth-first search explores outward one ring at a time, so the first time it reaches the goal it has found a shortest path. The visualizer animates that expanding frontier and then traces the path, and shows how many cells were expanded. It is the search behind pathfinding in puzzles like Color Lines and sliding-tile games.

Do LK Forge's games really use these algorithms?
Yes. LK Forge's games run classical search, not a language model pretending to play. Tic-Tac-Toe uses minimax with alpha-beta pruning (unbeatable on Hard), 2048 uses expectimax to average over random spawns, and puzzles such as Color Lines use breadth-first search for valid or shortest paths. This visualizer runs the same kinds of algorithm in a stripped-down, watchable form.