Winning a stone stacking duel against the computer
How columns are claimed and stolen, why the leaning rule decides everything, how the computer searches for the best move, and the tactics that turn borrowed columns into permanent points.

The idea behind the game
Cairn is a two-player strategy game played against the computer. A row of columns sits in front of you. You and the computer take turns placing one stone on any column. Whoever places the top stone on a column owns it. When all stones have been spent, you score one point for every column whose top stone is yours.
The twist is that ownership changes. If the computer places a stone on a column you own, that column is now the computer's. Nothing is final until nobody can build any higher. Every column is borrowed until the game proves otherwise.
The leaning rule
A column may never finish more than two taller than both of its neighbours. Think of it as a tower that needs something nearby to lean on. If both neighbours are short, the column cannot keep growing.
The ground outside the row counts as height zero. That matters most for the two end columns. An end column has one real neighbour on one side and the ground on the other. It becomes illegal to build on at a lower height than a column in the middle, because the ground never grows.
When a column is too tall for anyone to add to it, its owner has locked in that point. Nobody can steal it. The column is safe for the rest of the game. This is the most important thing in Cairn. A safe column is worth more than an unsafe one, because an unsafe column might change hands three more times before the stones run out.
Board sizes and stone counts
Three sizes are available. Small gives you five columns and eight stones each. Medium gives seven columns and eleven stones. Large gives nine columns and fourteen stones.
The stone count matters more than the column count. With eleven stones and seven columns, there are not enough stones to fight over every column. You must choose which ones to contest and which to let go. Spreading your stones across every column wastes them. The player who concentrates on fewer columns and locks them in will usually win.
Controls and the flow of a turn
Tap a column to place a stone. Your stone appears in your colour on top of the stack, and the column is now yours. Columns that are illegal to build on are dimmed and cannot be tapped.
After your move, the computer thinks for a moment and places its own stone. The scoreboard updates after each turn, showing how many stones you have left, how many columns you top, and how many the computer tops. The note below the board tells you which column the computer chose.
Press New Game to start over. Changing the board size also starts a fresh game.
How the computer decides
The computer searches ahead using a method called alpha-beta pruning. It looks at the current position, tries every legal move, then tries every response to each of those, and so on, several layers deep. At each position it counts how many columns each side tops, with extra weight for columns that are locked.
It also remembers positions it has already evaluated, so it does not repeat work. When several moves look equally good, it picks one at random, which is why it does not play the same game twice.
All of this runs on your device. The search is small enough to finish in a fraction of a second, because the number of columns is modest and the stone budget limits how deep the game can go.
Locking the end columns early
The cheapest points on the board are the two end columns. Because one of their neighbours is the ground at height zero, they become illegal to build on at a lower height than any middle column. A stack of three at the end with nothing beside it is already locked, because the next stone would be more than two above both the ground and the one neighbour.
Early in the game, race to top an end column and then build beside it just enough to keep the other end reachable. If you lock both ends, you start with two safe points and the computer has to fight for everything in the middle.
The staircase trap
Every stone you place raises a column by one. That lifts the ceiling for the columns next to it, because they are now allowed to be two taller than a higher neighbour. In other words, building up in one spot unlocks the spots beside it.
This is how the computer steals your columns. You build column four to height five, and suddenly column three can reach seven, and column five can reach seven. The computer places on a column you thought was safe, because your own building raised the limit.
The fix is to think about what your move allows, not just what it claims. Before you tap, look at the neighbours. Will raising this column let the computer reach a column you already own? If so, consider placing somewhere else first.
Spending the last stones
The endgame is where most games are decided. When you have three or four stones left, every placement must count. There are two mistakes to avoid.
The first is topping a column the computer can immediately cover. If the computer has stones left and the column is still legal to build on, you have wasted your stone. Count the computer's remaining supply before you place. If it has enough to cover you, that column is not safe.
The second is saving stones for too long. If you hold back while the computer places freely, it may lock several columns before you act. There is a balance between patience and urgency. The best approach is to place on columns you can lock in one move, because those points are guaranteed.
A safe column is worth two points
When you lock a column, you gain a point and deny the computer a point. That is a swing of two. Compare this with topping an unsafe column. You gain a point now, but the computer can take it back on its next turn, which means you gain nothing and spent a stone.
This is why the game rewards defensive building more than aggressive claiming. The player who locks three columns will usually beat the player who briefly tops five but locks none. Focus on permanence.
Reading the scoreboard
Three numbers track the game as it unfolds. Your stones shows how many you still have to place. Columns you top counts the columns where your stone is currently on top. Computer tops counts the same for the other side. The total of these two counts plus any empty columns always equals the board width.
After the last stone is placed and neither side can legally build, the game ends. The side with more columns topped wins. If both sides top the same number, the result is a draw. Draws are uncommon but they do happen, especially on the small board where five columns and eight stones leave room for an even split.
Common mistakes and how to avoid them
- Placing on every column to get a high count early. Those columns will all change hands, and you will run out of stones before you can defend them.
- Ignoring the computer's stone count. If it has seven left and you have three, it can outlast you on any column that is still open.
- Building the middle columns first. The ends are cheaper to lock. Start there.
- Raising a column without checking what it opens for the neighbours. The leaning rule works both ways.
- Playing the first move on a column the computer can immediately cover and lock. Look at the heights around your target before you tap.
- Forgetting that a draw is possible. When each side tops the same number of columns, the game is tied. If the computer is ahead by one, you need to steal two columns, not one, because taking one from it and giving yourself one changes the gap by two.
No data leaves your browser
The computer opponent runs entirely on your machine. There is no server involved in any part of the game. The search algorithm, the board state, and your score history all live in your browser. You can play offline after the page loads and nothing will change about how the game works.
