|
1 | | -chess-cpp |
2 | | -========= |
| 1 | +# chess-cpp |
3 | 2 |
|
4 | | -Source code for the program made in my master thesis: Generation and compression of endgame tables in chess with fast random access using OBDDs. |
| 3 | +TLDR: Don't waste your time by looking here. |
5 | 4 |
|
6 | | -Status for project is currently unknown, it's not well documented, etcetera. |
| 5 | +Source code (C++98) for the program made in my master thesis: Generation and compression of endgame tables in chess with fast random access using OBDDs. |
| 6 | + |
| 7 | + |
| 8 | +# Bugs |
| 9 | + |
| 10 | +When I wrote this program I made use of several optimizations that we're based on how the compiler I was using happened to behave. |
| 11 | +In some cases this was a deliberate (but bad) choice. In most cases I didn't know better. |
| 12 | + |
| 13 | +These are some of the mistakes that I've been hit by: |
| 14 | +* I assumed that a `char` was an unsigned 8 bit integer. |
| 15 | +* I assumed that I could write to one union member and read the corresponding bits from another union member |
| 16 | + |
| 17 | +A few times I've tried to rectify the errors and make the program work again. |
| 18 | +But this is hard work with 35k lines of poorly documented code :-/ |
| 19 | + |
| 20 | +Currently large parts of it is working (in a dockerized build environment) but there are still significant problems. |
| 21 | + |
| 22 | +Known bugs |
| 23 | +* Some short versions of commands causes crash (e.g. "ctfi ..." instead of "construct from table index ...") |
| 24 | +* With retrograde construction many (all?) invalid positions are stored as draw (-125) instead of illegal (-128). This reduces how much the tables can be compressed as OBDDs. |
| 25 | +* The 5 piece KPPKP endgame cannot be constructed as it contains a position with a depth to mate of 127 (`8/8/8/8/1p2P3/4P3/1k6/3K4 w - - 0 1`). This cannot fit in the `uint8_t` as values -124 and below are reserved. |
| 26 | +* When compiled against XBoard an error is logged when quitting the program (`free(): double free detected in tcache 2`) |
| 27 | +* Retrograde construction of KBNKP fails for a position with a pawn at an invalid square: |
| 28 | +``` |
| 29 | +Error: Retrograde constr.: Player from index = 9217 |
| 30 | +(it is 1 to move) |
| 31 | +Num checks = 0 |
| 32 | + a b c d e f g h |
| 33 | + +-----------------+ | |
| 34 | +8 | | 8 | 50b |
| 35 | +7 | | 7 | |
| 36 | +6 | | 6 | White has lost castling |
| 37 | +5 | | 5 | Black has lost castling |
| 38 | +4 | | 4 | |
| 39 | +3 | | 3 | moves played since progress = 0 |
| 40 | +2 | N | 2 | |
| 41 | +1 | k p K B | 1 | |
| 42 | + +-----------------+ | |
| 43 | + a b c d e f g h |
| 44 | +FEN: loadfen 8/8/8/8/8/8/N7/kpKB4 b - - 0 50 |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | +# What seems to work |
| 49 | + |
| 50 | +* The endgames tables that are built seems to be correct. At least they are correct for some longest mates for 5 piece endgames ([test.com](src/test.com)) |
| 51 | +* The chess engine can be used by xboard (tested with version 4.9.1). As command use `make run_xb` using the root of this repository as folder. This assumes you have docker installed. Maybe you should run `make run_xb` first to prebuild the image. |
0 commit comments