Since you’re here...

... we have a small favour to ask. More people, like you, are reading and supporting our blog: "Chess Engines Diary". And unlike many other sites and blogs, we made the choice to keep our articles open for all, regardless of where they live or what they can afford to pay.

We hope you will consider supporting us today. We need your support to continue to exist, because good entries are more and more work time. Every reader contribution, however big or small, is so valuable. Support "Chess Engines Diary" even a small amount– and it only takes a minute. Thank you.

============================== My email: jotes@go2.pl



A retrograde chess engine: Chass 1.0.0

Chass - a retrograde chess engine


Chass 1.0.0 download

This program provides a command line interface for computing “backward” moves available from a given chess position. It can be used to solve simple [retrograde analysis](https://en.wikipedia.org/wiki/Retrograde_analysis) problems.

The simplest way to use the program is as follows:
1. Create a text file, named, for example, `input.fen` and put the (extended) FEN notation of the position to analyze in the first line of the file.
2. While in this folder, run `chass -d {depth} -e {extra} -r < input.fen > output.txt` (replace `{depth}` and `{extra}` with corresponding non-negative integers). Unless you’ve installed Chass with `make` as described above, you also need the `chass` executable file to be in the same folder.
3. Chass will perform necessary computations printing the current progress to the terminal every second. The output file that you’ve specified in the command (in our case, `output.txt`) will be (re)created and then appended with possible sequences of moves as the program discovers them.


## Extended FEN

The position notation Chass understands is just like [FEN](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation), except it allows not specifying any information about a position beyond the piece placement and turn:

- You can use `?` for the castling slot indicating that the availability of castling is not known (the character is also allowed to be used for describing positions where castling is clearly impossible).
- You can also use `?` for the en passant slot indicating that the availability and/or identity of the en passant square is not known (the character can be used for describing positions in which en passant capture is clearly impossible as well).
- You can use `?` for the half-move clock if the half-move number is unknown.
- Finally, you can use `?` for the full-move counter if the full-move number is unknown.
- The notation can omit one or several slots at the end altogether. In this case, all remaining slots will be treated as unknowns.

Some examples:
```rnbqkbnr/ppp1ppp1/7p/3pP3/8/8/PPPP1PPP/RNBQKBNR w KQkq d6 0 3
```
```r1b1kbnr/pp2pppp/8/2pp4/2PP4/8/PP2PPPP/R1B1KBNR b ? ? ? 6
```
```8/8/3r4/4K3/8/4kqpb/8/8 b
```

## Command line arguments

Chass accepts three command line arguments:

- `-d {depth}` where `{depth}` is a non-negative integer. This defines a ply depth up until which all move sequences will be enumerated.
- `-e {extra depth}` where `{extra depth}` is a non-negative integer. This defines the number above `-d` such that every found sequence of moves will be extended with this many legal plies to “prove” that it is in fact possible.
- `-r`. If set, progress will be reported to `stderr`.

Either `-d`, `-e`, or both should be provided. If only one is set, another’s value is considered to be zero.

## Output

Chass outputs sequences of moves as it discovers them. Every found solution consists of the following:

1. Initial position: position before the sequence of moves is performed. It is presented in FEN (piece placement only).
2. (If the extra depth is positive.) The sequence of extra moves in extended algebraic notation.
3. (If the extra depth is positive.) Intermediate position in FEN (piece placement only) after the extra moves but before the main sequence of moves is performed.
4. The main sequence of moves in extended algebraic notation.
5. Every solution is ended with a line consisting of five dashes.

If no solutions are found, the file will be empty. This can also happen if the position itself cannot occur in a legal game.

Extended algebraic notation of moves is much like [long algebraic notation](https://en.wikipedia.org/wiki/Algebraic_notation_(chess)#Long_algebraic_notation), but it additionally includes some extra information necessary for unambiguously identifying moves when performing them backwards.

If the full-move number for the input position is not known, moves in the solution are labeled with negative numbers.

## Strategies

Currently, Chass utilizes two different strategies to reconstruct games:

- Simple [backtracking](https://en.wikipedia.org/wiki/Backtracking). This strategy is applied when the current move is not known or it is larger than what Chass needs to retract (more specifically, the requested full enumeration depth is not equal to the number of plies played). If progress reporting is on, it displays the number of the currently examined position at each level of the tree as well as the total number of positions at the respective levels.

- [Meet in the Middle](https://medium.com/@sherlock_ed/programming-meet-in-the-middle-technique-5025dbc1c6b6) technique. This strategy is employed when the current move number is known and Chass needs to restore the game all the way up to the starting position (more specifically, the requested full enumeration depth is exactly equal to the number of plies played, with the extra proof depth being zero). If progress reporting is on, the number of the ply under consideration will be shown, along with the total number of plies to reconstruct. For the current ply, the number of the presently examined option and the total number of options are also displayed.

## Some extra points
Chass isn’t supposed to miss any sequences of moves that can lead to a given position in a legal game. That is, there shouldn’t be any false negatives. However, unless the reconstruction is from the starting position, false positives are possible (since the program doesn’t by itself attempt to build a full proof game for any sequence of moves that it generates).

Furthermore, Chass doesn’t eliminate games with threefold repetition, nor those that violate the fifty-move rule. This is because the rules only apply when a claim is made by a player and not automatically, so mathematically such games are possible.

## Tests
Tests can be run with `ctest --verbose`. For more extensive testing, replace the file `test/data/games.pgn` (use concatenated games in [Portable Game Notation](https://en.wikipedia.org/wiki/Portable_Game_Notation)) and/or add problems to `test/data/problems.txt`. A problem’s description consists of four lines:

1. Extended FEN. This is what the input to Chass would look like.
2. Full enumeration depth and extra depth. This is what would be passed as `-d` and `-e` respectively.
3. The number of solutions expected to be found.

4. An empty line (a separator).

Comments

Popular posts from this blog

New chess engine: HypnoS 190324 (derived from Stockfish)

New version chess engine: Lc0 BT4

SF-PRO 23.02.2024 wins Strong Engines Tournament (Tests by Jörn Gronemann, Heide, 2024.03.01)

INCOGNITO 7 and Killfish 130324 wins Strong Engines Tournament (Tests by Jörn Gronemann, Heide, 2024.03.15)

SF-PRO 08.03.2024 wins New Engines Test, 09-10.03.2024

Chess engine: SF 16.1 MPV

Chess Engines Diary Rating (Stockfish and clones) - 03.03.2024