Take turns drawing a line between two neighbouring dots. Draw the third side of a small triangle to claim it, then go again. Claim the most triangles to win. Play a friend on this device, or the AI, which plans its moves with Monte Carlo Tree Search, playing out thousands of random games in your browser.
You
0
AI
0
Your turn: draw a line between two dots.
Your record against the AI: 0 wins, 0 losses, 0 draws
The AI uses Monte Carlo Tree Search (MCTS). It knows the rules but no strategy. Instead, it plays out lots of quick imaginary games from the current position and picks the move that worked out best. Each imaginary game has four steps:
It repeats this for up to 0.8 seconds, which is usually over 100,000 games, then plays the move it explored most. It stops sooner when one move is clearly best, and runs in the background so the page stays responsive.
One tweak helps: each move starts with a hint based on its kind. Taking a triangle looks promising, and handing one over doesn't. That saves time on obviously bad moves, while still letting the AI discover when giving up a triangle pays off.