What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Chess engines use Zobrist hashes as compact fingerprints of positions, then compare those fingerprints with earlier positions in the game or search line. The hash makes positions quick to identify, but it does not contain the history needed to count repetitions—and the draw rules, not the hash itself, determine when a game is drawn.

What a Zobrist hash represents

A Zobrist hash, or position key, is a number created from the rule-relevant features of a chess position. An engine prepares pseudorandom values for features such as a piece of a particular kind and color on a particular square, which side has the move, castling rights, and en-passant availability. It combines the values for the features currently present using the XOR operation. Stockfish’s source shows these categories in its key initialization: Stockfish position.cpp.

The result is a compact fingerprint, not a complete record of the board and not a mathematical proof that two positions are identical. Hash collisions are possible in principle: different states can produce the same key. A correct repetition detector must also include the state that matters under the rules and apply the repetition rules to the right history.

Why the board diagram alone is not enough

For repetition, identical piece placement does not always mean an identical position. The side to move and the available moves matter. Under Article 9.2.3 of the FIDE Laws of Chess, positions are considered the same only if “the same player has the move, pieces of the same kind and colour occupy the same squares and the possible moves of all the pieces of both players are the same.” The current cited Laws took effect on 1 January 2023 and govern over-the-board play: FIDE Laws of Chess.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Side to move: A position with White to move is different from the same piece placement with Black to move.
  • Castling rights: Moving a king or rook can remove a castling possibility. A later position with the same pieces on the same squares is not equivalent if that right has been lost.
  • En-passant availability: A position differs when an en-passant capture was available at the start of the sequence being compared, even if the pieces otherwise occupy matching squares.

These details are why a repetition key must reflect rule-relevant state, not just occupied squares.

How engines update the key after a move

XOR makes it practical to update the key incrementally. When a move changes the position, the engine XORs out the keys for features that no longer apply and XORs in the keys for the new features. It can therefore update the fingerprint without rebuilding it by checking every square. For example, moving a piece changes its piece-square features; the move may also change side to move, castling rights, or en-passant availability.

This is useful because engines consult position keys repeatedly while searching. The same key can also help locate a transposition: a position reached through one sequence of moves may be reached through a different move order. A transposition-table lookup and a repetition test both use position identification, but they are not the same task. Repetition requires knowing whether the position occurred earlier along the relevant history.

Why history is essential to repetition detection

A current-position snapshot can tell an engine what position it has now; it cannot tell the engine how many times that position has appeared. The detector must compare the current key with earlier keys or otherwise track prior positions, and it must know which history is relevant. That can include the played game and, during search, positions on the current search line.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Stockfish’s UCI documentation recommends supplying a position’s move list when setting it up, because the move history enables correct threefold-repetition detection: Stockfish UCI & Commands. Sending only a final board position discards the earlier occurrences that a repetition check may need.

From a repeated key to a draw under FIDE rules

A repeated hash is evidence the engine can use to identify a candidate repeated position; it is not itself a draw declaration. Under Article 9.2 of the FIDE Laws, a player with the move may claim a draw when the same position is about to occur for the third time by indicating the move that will produce it, or when it has just occurred for at least the third time. Article 9.6 makes a game drawn if the same position has appeared five times. The claim procedure and automatic fivefold rule are distinct outcomes.

An engine therefore has to combine position recognition, the relevant sequence of earlier positions, and the applicable rule. Treating “the same board appeared again” as sufficient skips the side-to-move and move-rights checks, the history count, and the difference between a claimable threefold repetition and an automatic fivefold draw.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How Stockfish implements repetition detection

Stockfish’s source comments that it uses Marcel van Kervinck’s cuckoo algorithm for repetition detection, with two hash tables indexed using Zobrist hashes to find recurring positions. Its implementation is one example, not a standard every engine must follow: an engine could instead scan earlier keys or maintain occurrence counts. These approaches differ in lookup and update costs, memory use, and implementation complexity; the important requirement is that the method account for the relevant state and history.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Chessnut Move – Robotic Chessboard with Plastic Pieces, Self-Moving Pieces Simultaneously, Full Piece Recognition, Built-in Chess Engine, Voice Control & Video Integration
  • 🤖 SELF-MOVING CHESS ON A REAL BOARD - Chessnut Move pairs a wooden chessboard with plastic Automated pieces that automatically move across the board, bringing digital games to life.Move can reposition multiple pieces at once to reset games quickly or build study positions with less setup time.
  • 🎯 1 MM FULL PIECE RECOGNITION - Identifies every piece and its exact board position for accurate move tracking. A 10 Hz refresh rate and 0.1-second response support automated moves averaging under three seconds.
  • 🚂BUILT-IN STOCKFISH ENGINE - Play or practice against built-in engines such as Stockfish directly on Chessnut Move, with adjustable Elo difficulty and no phone, computer, or app required.
  • 📹VIDEO & ENDGAME IMPORT VIA APP - Connect to the Chessnut App to import positions or replay tutorial and tournament moves automatically on the physical board. Practice endgames, openings, and tactics with minimal setup.
  • 🔗ONLINE PLAY WITH AUTO RESPONSES - Connect through the Chessnut App to Chess-com, Lichess, and other supported platforms; your opponent's moves are automatically played on the physical board.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.