How the engine thinks
This is not a general essay on game AI. Every number on this page was measured from this engine, with the same move generator and the same evaluation the app plays with. And every section ends the same way: the human version — because four of the engine's five ideas are things a person can do at the board, and doing them is most of what separates a strong player from a fast one.
The whole thing
Everything after this is an elaboration of these six lines.
Only step 3 is arithmetic a person cannot do. Steps 1, 2, 4, 5 and 6 are procedures — habits of looking — and a human who adopts them plays enormously better than one who does not, without calculating any faster.
Idea one
A single number, from White's side. Positive is good for White.
The engine's whole judgement of a position is five terms added up. That is all. It has no plans, no openings book, no memory of past games.
| Term | Worth |
|---|---|
| A man | 100 |
| A king | 320 |
| Each row a man has advanced | +4 |
| A man still on its own back row | +6 |
| A piece in the middle files / middle rows | +3 / +2 |
| A piece on an edge file | −2 |
Here is what that actually looks like, computed square by square by putting a single white piece on an empty board and asking the engine what it sees. Darker is worth more.
Two things jump out of that picture, and both are real advice.
You cannot add five terms per position at speed. You do not need to. Run the same five terms as a ranking, not a sum:
material → kings → advancement → centre → back rank. Compare two candidate moves on the first term where they differ, and stop. That reproduces most of the engine's judgement, and it takes a second.
It has no idea whether a piece is about to be taken. It counts what is on the board right now. Everything that makes this game sharp — the sacrifice, the shot, the forced sequence — is invisible to it. That is what the search is for, and it is why the next four ideas exist.
Idea two
One rule, applied all the way down.
The engine never asks "what do I hope happens?" It asks: after my move, what is the worst my opponent can do to me? And to answer that it asks the same question from their side. All the way down.
The trick that makes the code short is that a position's value to me is exactly the negative of its value to you. So there is only one function, and it flips sign each ply:
// the value of this position to whoever is about to move score = max( over every legal move m ) of -value_after(m)
That minus sign is the whole idea. It is why the engine cannot fool itself: it never gets to assume you will blunder.
The commonest way club players lose is playing a move because of what it threatens, without checking what it allows. That is hoping, not negamax.
The fix is a habit, not a talent: after you pick a move, before you touch it, ask one question — "and then what do they play?" — and answer it out loud. In this game the answer is often not a choice at all, which is what makes it cheap.
Idea three — the big one
This removes over ninety per cent of the work, and it is the idea most worth stealing.
Suppose you have already found a move that guarantees you at least +1. Now you start looking at a second move, and the very first reply your opponent has takes a man. You can stop. You do not need to know whether their best reply takes one man or three. You already know this move is worse than the one you have. Every remaining reply is wasted breath.
That is the entire algorithm. Two numbers — the best you have already guaranteed (alpha), and the best your opponent has already guaranteed (beta) — and one rule: when they cross, stop reading this branch.
Press the button to walk the search.
Here is what that saves in this engine. Both columns search the same tree with the same evaluation; only the cutoff differs.
Read the last row. At depth seven, plain search looks at positions. With alpha-beta it looks at . Same answer, same move, fewer positions examined.
Refutation-first. When you look at a candidate move, do not try to work out how good it is. Try to find one reason it fails. The moment you find one, drop the move and go to the next — you do not need to measure the damage.
Most players calculate the opposite way round: they pick the move they like and look for a line where it works. That is the expensive direction. Looking for the refutation is cheap, because you only need one, and the mandatory-capture rule usually hands it to you.
The same habit is why you can hold a long forced sequence in your head: you are not evaluating it, you are checking one thing at each step.
Idea four
Where writing this guide turned up a real bug in the engine.
Alpha-beta's saving depends entirely on the order you try moves in. If your first move is the best one, every other move gets refuted quickly against a high bar. If your first move is the worst one, the bar starts on the floor and nothing gets cut.
So this engine sorted its moves before searching — by how many men each capture lifted, biggest first. That is the standard heuristic in chess-like games, and here it is completely inert. The reason is a rule of this game:
Capture is compulsory and must be maximal. So if a capture exists at all, every legal move in that position captures exactly the same number of men. Measured across a full game: in 100% of positions with more than one legal move, every move had an identical capture count.
The sort key was a constant. The sort did nothing but preserve the order the generator happened to produce.
Replacing it with a key that actually varies — score each move by a single static evaluation of the position it reaches, one ply deep — gives this:
Fewer positions is only interesting if it means more depth in the same time. It does. Same machine, same time budget, before and after the change:
A whole extra ply at every budget. And depth is not a vanity metric — playing the engine against itself at fixed depths, the deeper side won of games.
Look at moves in the right order and you will calculate two or three times less. The order is: forced moves, then captures, then crownings, then advances, then the rest.
Most players scan the board left to right. Scan by forcing-ness instead. It costs nothing and it is the difference between seeing a combination and not.
Idea five
The single most dangerous thing a search can do is stop at the wrong moment.
Suppose the engine's time runs out exactly after it has captured a man. The evaluation looks at the board, counts a man up, and reports a fine position — not noticing that the opponent recaptures two next move. Stopping in the middle of an exchange does not give you an approximate answer. It gives you a wrong one.
So when the search reaches its depth limit, it does not evaluate immediately. It checks whether a capture is pending, and if one is, it keeps going — captures only — until the board is quiet. Only then does it count.
Here is the size of the error being avoided, from real positions in a real game. "Static" is what the evaluation says mid-exchange; "settled" is what the position is actually worth once the captures are played out:
Count to quiet, not to even. Never stop a calculation on a capture. Follow the exchange to the point where neither side has a capture available, and only then count material.
This is the most common blunder in the game and it is not a failure of vision — it is stopping one ply early. The recapture that beats you is usually the one you did not bother to look at because the count was already even.
Idea six
Why the engine searches depth 1, then 2, then 3 — instead of going straight to 8.
It looks wasteful. It is not, for two reasons.
What the clock actually buys, on this machine:
Note the shape of it: four times the thinking time buys roughly one extra ply. That is what an exponential tree feels like from the outside, and it is why "think longer" has sharply diminishing returns compared to "think in the right order".
Do not calculate the first line you see to its end. Look at all your candidate moves one ply deep, pick the best-looking one, then look at all of them two plies deep starting with that one. You will find the refutation of a bad idea in the shallow pass, before you have spent three minutes on it.
It also means you always have a move ready. If your clock is short, you play the best thing from the last complete pass — never a half-finished thought.
Two small ones
When the only legal moves are captures, the engine does not spend a ply of its depth budget — it extends the search instead. The reasoning: a forced sequence has no branching, so following it costs almost nothing and leaves you looking at a real position rather than a half-resolved one.
The human version: when a sequence is forced, keep going. It is the cheapest calculation on the board — there are no choices to weigh, only squares to track. Players who stop at "it gets complicated here" are usually stopping exactly where it stops being complicated.
Winning positions are not scored as a flat "win". They are scored as
mate − ply, so a forced win that arrives sooner scores higher. Without
that, an engine that has seen a win will happily shuffle forever, because every move looks
equally winning.
The human version: when you are winning, take the shortest road, not the most elegant one. Trade pieces, simplify, crown. Complexity only helps the player who is losing.
The point of all this
The five habits, as one procedure you can run at the board.
You cannot out-calculate the machine. You do not have to. Almost all of its advantage over a club player comes from doing five cheap things reliably, and every one of them is available to you.
Take number three. Looking for the reason a move fails, instead of the reason it works, is the cheapest change you can make to how you think, and it is worth more than ninety per cent of the engine's search — measured, on this page.
Play at Club with commentary on. Before every move, name the opponent's best reply out loud. Then check the coach's "what to watch" line, which names it. You are training step two, and the feedback is immediate.
Every time a capture is available, say the whole sequence before touching a piece: "I take, they must take with that one, then I take two." If you cannot say it, do not play it. Watch your Mistake count fall.
Open Watch, set Sharp against Casual, and read the commentary. The engine's "The engine wanted X" line is a refutation you missed, handed to you. That is the single highest-value feedback in the app — it turns "I was wrong" into "here is the move I did not look at".
The engine is not clever. It is disciplined — it does five plain things without ever getting bored or hopeful. That is the part you can copy, and it is the part that wins games.
Recent
Everything here
Nothing here by that name.
Keyboard shortcuts