About Teeko
Teeko is a two-player game on a 5x5 board. You get four pieces, your opponent gets four pieces. There is no capturing. The goal is to make a line or a square. As with a lot of other games on this website, this was introduced to me through Math with Bad Drawings. You can read his explanation of the rules in this PDF.
How to Play
The board starts empty. White always moves first.
Phase 1 -- Placing. Players take turns placing one piece on any empty square, until all eight pieces are on the board.
Phase 2 -- Moving. From then on, a turn means sliding one of your pieces to an adjacent empty square. Adjacent includes diagonals, so a piece moves like a king in chess -- one square, any direction. You can't pass your turn.
You win the moment your four pieces form a winning pattern. That can happen in either phase: if you can drop your fourth piece straight into a win, the game is simply over.
Winning patterns
A win is four in a row -- horizontally, vertically, or diagonally -- or your four pieces sitting on the four corners of a square. The square can be any size, not just the little 2x2 one, which is the part that sneaks up on people. The four corners of the whole board is a win.
Here's one example of each family, with how many of that kind exist on the board:
I have not coded up any draw condition. In the moving phase, two stubborn players can shuffle back and forth forever.
Game History
Teeko was invented in 1937 by John Scarne, the card magician and gambling author, who spent decades promoting it and genuinely believed it would take its place next to chess and checkers. It didn't, but it's still a cool little game.
Rule sets vary slightly from source to source, mostly over what counts as a square. I take the Math With Bad Drawings version: squares of any size count as a win.
About the AI
The AI is a Monte Carlo Tree Search engine, written in Rust and compiled to WebAssembly. It runs entirely inside your browser, so if your computer is more powerful, then so is the AI.