refactor: drop the board and piece glyphs from the dashboard

The dashboard keeps the statistics, the principal variation and the
root moves; the board and the knight glyph in the titles are gone. The
statistics take the full width, with the evaluation and time bars
capped at about half of it.

Checked: node-limited UCI output is still identical to main, bench
unchanged.

Bench: 546018

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rektdieandclaude committed 2026-11-15 14:33:45 +01:00
1 parent c859163e2c
commit 4973535596
2 files changed
+10 -60

No files matched your search

+4 -4
View File
@@ -61,10 +61,10 @@ Extra commands:
`go depth N` limits the mean playout depth. `nodes` in `info` lines are playouts.
Started from a terminal, Rigby shows its search for a human instead: a framed
dashboard, redrawn in place ten times a second, with the board (the best move
highlighted), the score and an evaluation bar, depth, playouts, speed, a time bar,
tree fill, the principal variation in SAN and the most visited root moves with
their share of the visits, score and prior. It adapts to the terminal's size. The
dashboard, redrawn in place ten times a second, with the score and an evaluation
bar, depth, playouts, speed, a time bar, tree fill, the principal variation in SAN
and the most visited root moves with their share of the visits, score and prior.
It adapts to the terminal's size. 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 it. `NO_COLOR`
turns it off, `RIGBY_PRETTY=1` forces it into a pipe (e.g. `less -R`). It needs a
+6 -56
View File
@@ -212,45 +212,7 @@ struct Box {
};
// ---------------------------------------------------------------------------
// Board
// ---------------------------------------------------------------------------
constexpr int BOARD_WIDTH = 2 + 8 * 3;
Line board_row(const Position& pos, int rank, Move best) {
static constexpr const char* GLYPHS[] = {"♟", "♞", "♝", "♜", "♛", "♚"};
static const std::string LIGHT = bg(168, 140, 110), DARK = bg(122, 95, 73);
static const std::string LIGHT_HI = bg(176, 172, 82), DARK_HI = bg(136, 138, 58);
static const std::string WHITE_PIECE = BOLD + fg(255, 255, 255), BLACK_PIECE = BOLD + fg(18, 16, 22);
Line l;
l.add(std::to_string(rank + 1) + " ", LABEL);
for (int file = 0; file < 8; file++) {
const int sq = rank * 8 + file;
const bool light = (file + rank) % 2 == 1;
const bool hi = best && (sq == best.from() || sq == best.to());
const std::string& square = hi ? (light ? LIGHT_HI : DARK_HI) : (light ? LIGHT : DARK);
const int piece = pos.piece_on(sq);
if (piece == NO_PIECE) {
l.text += square + " " + RESET;
} else {
l.text += square + (piece_color(piece) == WHITE ? WHITE_PIECE : BLACK_PIECE) + " " +
GLYPHS[piece_type(piece)] + " " + RESET;
}
l.width += 3;
}
return l;
}
Line board_files() {
Line l;
l.add(" ");
for (char f = 'a'; f <= 'h'; f++) l.add(std::string(" ") + f + " ", LABEL);
return l;
}
// ---------------------------------------------------------------------------
// Statistics column, nine lines next to the board
// Statistics, nine lines
// ---------------------------------------------------------------------------
constexpr int LABEL_WIDTH = 10;
@@ -273,7 +235,7 @@ std::vector<Line> stats(const Dashboard& d, int width) {
const double q = eval::cp_to_q(d.cp);
const double white = d.root.stm == WHITE ? (q + 1.0) / 2.0 : (1.0 - q) / 2.0;
Line eval_bar = label("white");
const int bar_width = std::max(width - LABEL_WIDTH - 5, 4);
const int bar_width = std::clamp(width - LABEL_WIDTH - 5, 4, 48);
eval_bar.append(bar(white, bar_width, fg(240, 240, 245), fg(55, 55, 68), bg(55, 55, 68)));
eval_bar.add(pad_left(format("%.0f%%", white * 100.0), 5), VALUE);
out.push_back(eval_bar);
@@ -304,7 +266,7 @@ std::vector<Line> stats(const Dashboard& d, int width) {
Line progress_bar = label("");
if (progress >= 0.0)
progress_bar.append(bar(d.done ? 1.0 : progress, width - LABEL_WIDTH, CYAN, fg(45, 50, 66), bg(45, 50, 66)));
progress_bar.append(bar(d.done ? 1.0 : progress, bar_width + 5, CYAN, fg(45, 50, 66), bg(45, 50, 66)));
out.push_back(progress_bar);
// Tree memory: one square per tenth.
@@ -399,8 +361,6 @@ std::vector<std::string> render(const Dashboard& d, int frame) {
Box box{std::clamp(term.cols - 1, 52, 104), {}};
const int inner = box.inner();
const bool show_board = inner >= BOARD_WIDTH + 3 + 34;
const int stats_width = show_board ? inner - BOARD_WIDTH - 3 : inner;
// Fit the height: fewer root moves first, then no blank lines.
const int pv_max = 2;
@@ -416,24 +376,14 @@ std::vector<std::string> render(const Dashboard& d, int frame) {
const bool show_moves = rows >= 1;
Line title;
title.add("♞ Rigby", TITLE);
title.add("Rigby", TITLE);
Line status;
if (d.done) status.add("✓ done", BOLD + BRIGHT_GREEN);
else status.add(std::string(SPINNER[frame % 10]) + " searching", YELLOW);
box.top(title, status);
if (blanks) box.row(Line{});
const Move best = d.pv.empty() ? Move() : d.pv.front();
const std::vector<Line> right = stats(d, stats_width);
for (int i = 0; i < 9; i++) {
Line l;
if (show_board) {
l = i < 8 ? board_row(d.root, 7 - i, best) : board_files();
l.pad_to(BOARD_WIDTH).add(" ");
}
l.append(right[size_t(i)]);
box.row(l);
}
for (const Line& l : stats(d, inner)) box.row(l);
if (blanks) box.row(Line{});
Line pv_title;
@@ -485,7 +435,7 @@ std::atomic<int>& typed_lines() {
std::string banner(const std::string& name, const std::string& version, const std::string& author) {
Box box{58, {}};
Line title;
title.add("♞ " + name, TITLE).add(" " + version, VALUE);
title.add(name, TITLE).add(" " + version, VALUE);
Line right;
right.add("MCTS chess engine", LABEL);
box.top(title, right);