Games grouped by how far a plain algorithm can take us. Solved games give exact perfect-move hints. The Not solved side holds the games that need a real engine.
Four wolves, one sheep
Wolves step diagonally forward only (down the board). The sheep steps diagonally in any direction. Wolves win by trapping the sheep. The sheep wins by reaching the top row.
Solving every possible game…
Tap a piece, then tap a dot to move. The computer answers with perfect moves, and every move you make gets graded.
Why this one is fully algorithmic
A position is just the four wolf squares, the sheep square and whose turn it is.
Wolves never move backward, so every game is finite. That means the whole game tree can be searched to the end.
The page runs minimax with memoisation over every reachable position. Each position gets a score: who wins, and how many plies until the game ends.
A “perfect” move is one whose resulting position keeps the best score. The winner picks the fastest win, the loser picks the longest delay.
Rule of thumb the search keeps rediscovering: advance the rear wolf, keep the line staggered, and never leave a gap the sheep can slip through.
Checkers
English draughts: 12 pieces each, forced captures, kings move both ways.
Perfect-move engine: AI neededNot wired up yet. This is the extension slot.
Why a simple algorithm can’t do it
Checkers is solved: with perfect play from the start it’s a draw. But Chinook’s proof took years of computing, about 5 × 1020 positions, plus an opening book and an endgame database for every position with 10 or fewer pieces. That’s far beyond a single web page.
The socket for the AI extension
When we add the engine, it only has to answer one question. Everything else (board, hints, move grading) can reuse the pattern from the wolves game.
// engines.checkers plugs in here later
window.Engines = window.Engines || {};
Engines.checkers = {
// position: { pieces: [...], turn: "red" | "white" }
// returns: { from, to, captures: [...], value: "win" | "draw" | "loss" }
bestMove(position) { throw new Error("AI needed"); }
};
Things I can build now without AI: legal-move generation, forced-capture rules and playing against a human. The perfect-move part waits for the engine.
Nim
Take stones from one row each turn. The binary XOR trick below is the whole algorithm.
The algorithm
Write each row’s size in binary and XOR them (add each bit column, keep only odd/even).
XOR 0 on your turn means you’re losing against perfect play. Anything else means some row can be reduced to make the XOR 0, and that’s the perfect move.
If the last stone loses, play the same way until every row has 0 or 1 stones, then leave an odd number of single stones.
Kalah (mancala)
Sow seeds around the board and bank them in your store. Small boards are solved here; the standard board needs an engine.
Solved by search
Mū tōrere
Eight pieces, nine spots, one empty spot at a time. The search shows perfect play here is a draw.
Noughts & crosses
Pick a board size. The badge says whether perfect play can be computed for it.
Solved by search
Corner to corner
Halma-style race on 8×8. Step one square in any direction, or hop over a neighbour into the empty square beyond and keep hopping in the same turn. Move all 10 pieces into the opposite corner camp.
Blue tint: start campGold tint: goal camp
Turns used: 0
Tap a piece to see every square it can reach this turn, including whole hop chains.
What’s solved and what isn’t
ExactEvery square a piece can reach in one turn, with the route. That’s a breadth-first search over hop chains.
HeuristicHints and “Play best move” look three of your own turns ahead and pick the sequence that gains the most distance toward the goal corner. It finishes the camp, but it isn’t proven to use the fewest turns.
AI neededThe two-player game: blocking, ladders and timing against an opponent. I’d add that with the same extension socket as checkers.