Skip to content

TB_RESULTS

Andrew Grant edited this page Jul 16, 2024 · 2 revisions

unsigned TB_RESULT values are only returned from the tb_probe_root() function, which returns a move guaranteed to maintain the optimal WDL result. We must be able to confirm that the result is a valid one. We must be able to extract the WDL and/or DTZ values if we desire to convey a score to the UCI interface. We must be able to extract the encoded move and convert it to our own engine's format.

There are three special values for an unsigned TB_RESULT. Anything else implies a valid result.

  • TB_RESULT_FAILED
  • TB_RESULT_STALEMATE
  • TB_RESULT_CHECKMATE

The WDL and/or DTZ components of a result can be extracted with:

  • TB_RESULT_WDL(x) returns one of { TB_LOSS, TB_BLESSED_LOSS, TB_DRAW, TB_CURSED_WIN, TB_WIN }
  • TB_RESULT_DTZ(x) returns the ply-distance until the next capture, mate, or pawn push

To help convert the move encoding, the following macros exist:

  • TB_RESULT_TO(x) returns an unsigned to-square
  • TB_RESULT_FROM(x) returns an unsigned from-square
  • TB_RESULT_IS_ENPASS(x) returns 1 if Enpassant, otherwise 0
  • TB_RESULT_IS_QPROMO(x) returns 1 if a Queen Promotion, otherwise 0
  • TB_RESULT_IS_RPROMO(x) returns 1 if a Rook Promotion, otherwise 0
  • TB_RESULT_IS_BPROMO(x) returns 1 if a Knight Promotion, otherwise 0
  • TB_RESULT_IS_NPROMO(x) returns 1 if a Bishop Promotion, otherwise 0

Clone this wiki locally