Suggested moves

The editor's 💡 window extends a study by a greedy maximization of its expected score: at each step, it adds the one move of the studied side that raises the expected score most, until a number of moves has been added or a target score is reached. This page defines the objective, the set of admissible additions, the gain of an addition and the search for the best one, and states the method's limits. The command-line tool tools/optimal_repertoire.py implements the same method.

1. Objective

Let \(T\) be the study, a tree of moves rooted at its starting point. The studied side plays its prepared move in each position (the first child); the opponent plays each move \(m\) listed by the Opening Explorer in a position \(x\) with probability $$p_x(m) = \frac{n_x(m)}{\sum_{m'} n_x(m')},$$ where \(n_x(m)\) is the number of games in which \(m\) was played in \(x\). A line ends with its last answered move. The expected score is $$S(T) = \sum_{\ell \in L(T)} P(\ell)\, v(\ell),$$ where \(L(T)\) is the set of lines' ends, \(P(\ell)\) the product of the opponent's probabilities along the line and \(v(\ell) \in [0, 1]\) the value of its end. This is the expected score of the Stats page, with the end-of-prep value chosen in the editor's settings:

Since the studied side's moves carry probability 1, \(S\) is linear in the value of each position: a position \(t\) where the opponent is to move, reached with probability \(r_t\) and of value \(S_t\), contributes \(r_t S_t\) to \(S(T)\).

2. Admissible additions

An addition is a pair \((m, a)\): an opponent move \(m\), in a position \(t\) of the study where the opponent is to move, that the study leaves unanswered, and a move \(a\) of the studied side answering it. The position \(t\) is either inside a line, or after a line's last move, which the addition then extends. The reply \(m\) is admissible if its probability of being reached is at least a threshold \(\rho\) (0.2% by default): $$r_t\, p_t(m) \ge \rho.$$ When the starting point is a position of the studied side with no move prepared, the only additions are the studied side's first moves there. With “After the selected move only”, an addition is admissible only if \(t\) is the selected node or follows it, or if \(m\) is the selected node; \(S\), \(r_t\) and the gains remain those of the whole study, from its starting point.

The candidates \(A(y)\) in the position \(y = t \cdot m\) are the studied side's moves listed by the Explorer, by decreasing number of games: the first \(k\) (6 by default) with at least \(n_{\min}\) games (100 by default) that satisfy the soundness constraint, if one is set. A move \(a\) is sound when it loses at most \(\Delta\) centipawns against Stockfish's best move: $$\hat c(y) - \hat c(y \cdot a) \le \Delta,$$ with \(\hat c\) Stockfish's evaluation from the studied side, at the depth chosen in the settings, clipped to \([-1000, 1000]\) so that a forced mate counts as 10 pawns; the evaluation of \(y\) stands for that of its best move. The levels offered are \(\Delta = 10\) (best only), 25 (excellent or better), 50 (good or better), 100 (up to inaccuracies), a value of the user's, or \(\Delta = \infty\) (any move, the default; Stockfish is then not needed for this).

3. Gain of an addition

A new move \(a\) ends its line. Its value \(\lambda(a)\) is the end-of-prep value of §1 for a line ending with \(a\). Let \(v_t(m)\) be the current value of the reply \(m\) in \(t\), that of a line ending with \(m\), and $$S_t = \sum_{m'} p_t(m')\, v_t(m')$$ the value of \(t\) with the study's current answers. Answering \(m\) with \(a\) replaces \(v_t(m)\) by \(\lambda(a)\). If no reply in \(t\) was answered, the line ended with the move before \(t\), with value \(e_t\), and now goes on through \(t\). By the linearity of §1, the gain is exact: $$G(m, a) = r_t \left[\, S_t - p_t(m)\, v_t(m) + p_t(m)\, \lambda(a) - S_t^{\text{old}} \right],$$ $$S_t^{\text{old}} = \begin{cases} e_t & \text{if the line ended before } t, \\ S_t & \text{otherwise.} \end{cases}$$ For the first move at the starting point, \(G(a) = \lambda(a) - v_0\), with \(v_0\) the starting position's own value.

5. Limits