A Practical Algorithm for Chess Unwinnability

Author Miguel Ambrona

Thumbnail PDF


  • Filesize: 0.99 MB
  • 20 pages

Document Identifiers

Author Details

Miguel Ambrona
  • Independent Researcher, Madrid, Spain


Special thanks to Pooya Farshim, for very fruitful discussions and all his feedback; Elena Gutiérrez, for all her help and comments; Antonio Nappa, for providing the hardware; the Lichess Team; the Stockfish Team; and many others: https://chasolver.org/acks.html. I would also like to express my sincere gratitude to Andrew Buchanan and Andrey Frolkin, for sharing with me and letting me include two original compositions, and for all the feedback. Finally, I would like to thank Maarten Loeffler, for having found a gap in an earlier version of the proof of Lemma 8, and for all his comments. I am also very thankful to the other anonymous reviewers of FUN 2022, for their valuable time and careful reading of this manuscript.

Cite AsGet BibTex

Miguel Ambrona. A Practical Algorithm for Chess Unwinnability. In 11th International Conference on Fun with Algorithms (FUN 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 226, pp. 2:1-2:20, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022)


The FIDE Laws of Chess establish that if a player runs out of time during a game, they lose unless there exists no sequence of legal moves that ends in a checkmate by their opponent, in which case the game is drawn. The problem of determining whether or not a given chess position is unwinnable for a certain player has been considered intractable by the community and, consequently, chess servers do not apply the above rule rigorously, thus unfairly classifying many games. We propose, to the best of our knowledge, the first algorithm for chess unwinnability that is sound, complete and efficient for practical use. We also develop a prototype implementation and evaluate it over the entire Lichess Database (containing more than 3 billion games), successfully identifying all unfairly classified games in the database.

Subject Classification

ACM Subject Classification
  • Theory of computation → Design and analysis of algorithms
  • Software and its engineering → Software libraries and repositories
  • chess
  • helpmate
  • unwinnability
  • timeout
  • dead position


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Lichess Blog. Announcing instant chess!, 2017. URL: https://lichess.org/blog/WN7V-jAAAAdH8ITR/announcing-instant-chess.
  2. Josh Brunner, Erik D. Demaine, Dylan Hendrickson, and Julian Wellman. Complexity of retrograde and helpmate chess problems: Even cooperative chess is hard, 2020. URL: http://arxiv.org/abs/2010.09271.
  3. Andrew Buchanan. Dead reckoning, 2001. URL: http://anselan.com/tutorial.html.
  4. Andrew Buchanan. Dead reckoning: Castling & en passant. StrateGems. U.S. Chess Problem Magazine, 2001. URL: http://anselan.com/DRSGtext.html.
  5. Chess.com. Game 13251713497. URL: https://www.chess.com/game/live/13251713497.
  6. Daniel Dugovic. Helpmate solver, 2020. URL: https://github.com/ddugovic/Stockfish/blob/master/src/types.h#L159.
  7. International Chess Federation. FIDE Laws of Chess Handbook, 2018. URL: https://handbook.fide.com/chapter/E012018.
  8. Chess24. Community Feedback. Time ran out but insufficient material to mate - sufficient material, actually!, 2020. URL: https://chess24.com/en/community/feedback/time-ran-out-but-insufficient-material-to-mate---sufficient-material--actually.
  9. Chess.com. Forums. Is the best move to let your time run out?, 2021. URL: https://www.chess.com/forum/view/endgames/is-the-best-move-to-let-your-time-run-out.
  10. Robert A. Hearn. Games, puzzles, and computation. PhD thesis, Massachusetts Institute of Technology, 2006. Google Scholar
  11. Richard E. Korf. Depth-first iterative-deepening: An optimal admissible tree search. Artificial Intelligence, 27(1):97-109, 1985. URL: https://doi.org/10.1016/0004-3702(85)90084-0.
  12. François Labelle. Illegal moves by grandmasters, 2011. URL: https://wismuth.com/chess/illegal-moves.html.
  13. Lichess. Open database, 2022. URL: https://database.lichess.org/.
  14. J.I. Minchin, J. Zukertort, and W. Steinitz. London International Chess Tournament 1883. ISHI Press, 2012. URL: https://books.google.es/books?id=QEqyNAEACAAJ.
  15. Ornicar/lila. Issue number 6804. Detect all positions without a legal sequence of moves to checkmate, 2020. URL: https://github.com/ornicar/lila/issues/6804#issuecomment-724002709.
  16. Chess.com. The Rules of Chess. My opponent ran out of time. Why was it a draw? URL: https://support.chess.com/article/268-my-opponent-ran-out-of-time-why-was-it-a-draw.
  17. Chess.com. The Rules of Chess. What does ‘insufficient mating material’ mean? URL: https://support.chess.com/article/128-what-does-insufficient-mating-material-mean.
  18. Viktoras Paliulionis. Helpmate analyzer. URL: http://helpman.komtera.lt.
  19. Stockfish. Open source chess engine, 2022. URL: https://stockfishchess.org/.
  20. Ronald Turnbull. Dead reckoning: a new discovery in problem chess. The Problemist, pages 140-141, July 2001. URL: http://anselan.com/DRtPturnbull.html.
  21. Jakob Varmose. Deadposition2. URL: https://github.com/jakobvarmose/deadposition2.
  22. Wikipedia. Helpmate, 2021. URL: https://en.wikipedia.org/wiki/Helpmate.