**A variation of NIM I created with Claude (In like 3 minutes/4 sequential prompts. Bananas).**
Teach this one to kids. Don’t stop at *Tic-tac-toe*.
[https://claude.site/artifacts/96421b81-76eb-4132-b905-c613798f0574](https://claude.site/artifacts/96421b81-76eb-4132-b905-c613798f0574)
Setup and Rules:
1. The game starts with 21 empty cells arranged in a row.
2. Two players take turns - Player X and Player O.
3. On your turn, you must place your mark (X or O) in 1, 2, or 3 consecutive empty cells.
4. It does not matter which cells you fill, but it is nice to move in lines to easily see how many are left.
5. After placing your marks, click "Enter" to confirm your move and end your turn/
How to Win:
- The goal is to place the LAST mark(s) on the board.
- In other words, whoever fills the final cell(s) wins the game.
- This means you want to try to leave your opponent with no valid moves.
Strategy Tips (spoilers):
1. Count ahead to try to control key positions
2. Pay attention to how many empty cells remain
3. Key positions to control are positions where you can force your opponent into a losing situation/
4. For example, if there are 4 empty cells left and it's your opponent's turn, they must leave at least 1 cell for you to win. The trick is to think this way (backward induction) from the start.
5. The game is mathematically solvable - with perfect play, the player who goes first can always win (or the one who is rational and is the last to get the board into a multiple of four wins). How? Ideally, go first, and get the board into a multiple of 4. Then, all you need to do is 4 minus x. That’s the equation to solve the game. Subtract however many cells your opponent filled and fill that many cells on your turn. For example, if you go first, fill one cell. The board is now in a multiple of 4 (20 cells left). Player 2 fills 3 cells. 4 minus 3. You fill one cell. And so on. If both players are rational (understand the rules of the game) it is not worth playing. Walk away. :)
1. [Claude Artifact](https://claude.site/artifacts/96421b81-76eb-4132-b905-c613798f0574)