libscid snapshot+b450b7969924
Chess applications made easy.
Source on GitHub License GPL v2
Loading...
Searching...
No Matches
Code

Code is the compact ECO value model. The public text form is familiar opening classification text such as A00, B20, or Scid's extended C50a1; the stored form is a small integer suitable for sorting, persistence, range checks and statistics.

fromString() is the parse boundary. It accepts one-, two-, and three-character prefixes as the first code in that range, and it accepts canonical extended forms with a lower-case subcode and optional 1..4 extension. toBasicString() and toExtendedString() move in the other direction.

Domain Model

The code model is deliberately not a class hierarchy. Code is the packed value, String is the fixed output buffer, and the functions describe the legal transformations around that value. The important distinction is between display/range operations, which preserve the ECO ordering, and reduce(), which folds Scid numeric extensions into the same bucket as their parent subcode for statistics.

basicCode() removes Scid's extended suffix. lastSubCode() turns a prefix or partial extended code into the final concrete code covered by that range. ECO_None is the sentinel for "no known classification"; it can be parsed, formatted and range-expanded, but it is not a valid input to reduce().