Click a piece, then a marked square: move 1 2 3 4: level: EASY, STEADY, SHARP, SEVERE F: capture rule: compulsory (default) or optional N: new game C: how to play You are gold and move up the board. Legal destinations are ringed green, a capture is ringed red, and the stone you would take is boxed. When capture is compulsory, the pieces you are required to move are ringed in red; the panel always states which rule is in force.
American/English draughts against a minimax engine — with the rules that actually make it checkers, including the one almost every implementation gets wrong. THE RULES PEOPLE GET WRONG These are the whole point, so here is where each one lives. Capturing is mandatory — by default, and switchable; see the toggle section below. With it on, if any capture exists nothing else is legal. This is enforced structurally, not by filtering: gen_moves generates captures first and returns the moment it finds any, so in a position with a jump available a quiet move is never even constructed. It is the defining rule of the American game and it is what makes a sacrifice that forces a recapture the whole of the tactics. Multi-jumps continue in the same turn. Handled in the search rather than in a loop: applying a jump and finding the same piece can jump again recurses with the same side to move and the same remaining depth, because it is the same turn. One jump per node keeps undo to three lines, and the engine sees a four-piece combination as a single move exactly as the player does. Men move and capture forward only; kings both ways. One test in the direction loop — if the piece is a man and dr != 0 - side, skip — which works because the side is carried in the sign of the piece. Crowning ends the turn. A man that promotes part-way through a jump does not keep jumping. This is the single most commonly mis-implemented rule in draughts, because the natural way to write a jump loop keeps going. The continuation test is explicitly promoted == 0 and there is another capture, and there is a dedicated test for it in tools/rules.py. A side with no legal move loses, whether or not it still has pieces. Because move generation runs before the depth cutoff, a node with zero moves is detected as terminal everywhere in the tree and not only at the root — so the engine will deliberately block you rather than only hunt material. Draws are by a no-progress rule: 80 plies with no capture and no man moved. Two kings shuffling forever is the position it exists to end. THE CAPTURE RULE IS A TOGGLE — `F` Both rules are real, and the project plays either. Compulsory capture is the default, because it is the codified rule: WCDF and English draughts, and also International, Russian, Italian and Brazilian. It is why huffing existed — the penalty for declining a jump was that your opponent could remove the offending piece. Optional capture is nonetheless extremely common in casual play, and refusing to support it would be refusing the game a lot of people actually play. With the toggle off: - quiet moves become legal even when a capture is available; - a jump that lands on another jump may be broken off — click the jumping piece to stop; - the engine gets the same freedom, which matters: with capture optional, declining a jump is sometimes correct, so the generator feeding minimax includes the non-capturing moves. Crowning still ends the turn under both rules. A man promoted mid-chain never continues, whichever way the toggle is set. The rule in force is stated in the side panel in its own colour, and the help panel text switches with it, because a player who does not know the setting will think the engine is broken either way — refusing their quiet move, or declining a jump it "should" have taken. All original - code, art and sound. See Inside is open.