Skip to content

tb_probe_root

Andrew Grant edited this page Feb 13, 2026 · 2 revisions
unsigned tb_probe_root(
    uint64_t white,    uint64_t black,
    uint64_t kings,    uint64_t queens,
    uint64_t rooks,    uint64_t bishops,
    uint64_t knights,  uint64_t pawns,
    unsigned rule50,   unsigned ep,
    bool     turn,     unsigned *results);

Calling Conditions:

  • Can only be called when neither player has any Castling Rights remaining
  • Can only be called when the # of pieces is less than or equal to TB_LARGEST
  • Can only be called by one thread at a time

Non-trivial Parameters:

  • rule50 is the fifty-move counter
  • ep is the Enpassant Square, as described in a typical FEN. If there is no square, the value must be 0
  • turn must either be PYRRHIC_WHITE, or PYRRHIC_BLACK. Those constants may differ from your own engine
  • results may be NULL, or a pointer to some unsigned results[TB_MAX_MOVES]

Return Value:

  • Failed probes will return TB_RESULT_FAILED
  • Probes in already finished games will return TB_RESULT_STALEMATE or TB_RESULT_CHECKMATE
  • Successful probes will return an unsigned TB_RESULT

Additional Notes:

  • The move encoded in the return value is guaranteed to preserve the optimal WDL result
  • Moves in the results array are not guaranteed to preserve the optimal WDL result
  • Moves in the results array can have wrong WDL results when repetitions have occurred
  • This function should not be used for "Filtering" the Root Moves of an engine's search

Clone this wiki locally