Coloured search output for a terminal #5

Merged
claude merged 1 commits from pretty-print into main 2026-11-15 14:17:02 +01:00
Collaborator

Started from a terminal, Rigby now shows its search for a human instead of UCI info lines:

  • Progress lines at 125, 250, 500 ms and then every second: depth/seldepth, playouts, speed, time, a tree fill bar (green / yellow / red), score in pawns coloured by sign and size, and the PV with the move to play highlighted and deeper moves fading.
  • Root move table at the end: the most visited root moves with a bar for their share of the visits, their score and prior.
  • Tree reuse, collections and checkmate/stalemate roots are shown as notes; bestmove is highlighted.

The first uci command switches to plain UCI output for good. GUIs and match runners send it first and read stdout through a pipe, so they never see the coloured output. NO_COLOR turns it off. On Windows the console gets ANSI processing and UTF-8 output. The code is in src/pretty.cpp / src/pretty.h; the README describes the mode.

Testing

No SPRT: the change only affects output before uci, never search (non-regression test #5287 was stopped at the author's request).

  • The UCI output of a scripted session (two searches with tree reuse, a stalemate root) is identical to main apart from nps and time.
  • go wtime, go infinite + stop and quit work.
  • The pretty mode was driven in a real console, including the switch to UCI.
  • The bench is deterministic and unchanged.

Bench: 546018

🤖 Generated with Claude Code

Started from a terminal, Rigby now shows its search for a human instead of UCI info lines: - **Progress lines** at 125, 250, 500 ms and then every second: depth/seldepth, playouts, speed, time, a tree fill bar (green / yellow / red), score in pawns coloured by sign and size, and the PV with the move to play highlighted and deeper moves fading. - **Root move table** at the end: the most visited root moves with a bar for their share of the visits, their score and prior. - Tree reuse, collections and checkmate/stalemate roots are shown as notes; `bestmove` is highlighted. The first `uci` command switches to plain UCI output for good. GUIs and match runners send it first and read stdout through a pipe, so they never see the coloured output. `NO_COLOR` turns it off. On Windows the console gets ANSI processing and UTF-8 output. The code is in `src/pretty.cpp` / `src/pretty.h`; the README describes the mode. ## Testing No SPRT: the change only affects output before `uci`, never search (non-regression test #5287 was stopped at the author's request). - The UCI output of a scripted session (two searches with tree reuse, a stalemate root) is identical to `main` apart from nps and time. - `go wtime`, `go infinite` + `stop` and `quit` work. - The pretty mode was driven in a real console, including the switch to UCI. - The bench is deterministic and unchanged. Bench: 546018 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude added 1 commit 2026-11-15 14:16:53 +01:00
Started from a terminal, Rigby now shows its search for a human:
coloured progress lines (depth/seldepth, playouts, speed, time, a tree
fill bar, score in pawns, the PV fading with depth) at 125, 250, 500 ms
and then every second, and at the end a table of the most visited root
moves with a bar for their share of the visits, their score and prior.
Tree reuse and collections are shown as notes, and bestmove is
highlighted.

The first "uci" command switches to plain UCI output for good. GUIs and
match runners send it first and read stdout through a pipe, so they
never see the coloured output. NO_COLOR turns it off. On Windows the
console gets ANSI processing and UTF-8 output.

Checked: the UCI output of a scripted session (two searches with tree
reuse, a stalemate root) is identical to main apart from nps and time;
go wtime, go infinite with stop, and quit work; the pretty mode was
driven in a real console, including the switch to UCI. Search is
untouched, so the bench is unchanged.

Bench: 546018

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude merged commit 31a35fd84f into main 2026-11-15 14:17:02 +01:00
claude deleted branch pretty-print 2026-11-15 14:17:03 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rektdie/Rigby#5