A new design for Xianqgi (Chinese chess) Endgame Tablebase
Posted: Tue Jan 16, 2018 2:36 am
Hi all,
I have designed and implemented a new Xiangqi egtb (named Felicity egtb) with DTM metric, focusing on reducing its size.
The main idea to reduce sizes is so simple: omit some pieces on some specific positions which effect minimum to results. The missing information could be retrieved later by using extra computing and / or by using cheap extra databases.
By omitting some pieces' positions (ignore them when creating indexes), some different chess positions could share same indexes. The properties of the new egtb differ from traditional ones. Below are interesting:
- one chess position could be indexed into one index only, but one index could be represented for multi chess positions (one to many)
- score of an index could be undetermined
That is why we call the new one as "undetermined" egtb.
For Xiangqi, at the moment the new design could apply for a special class of endgames in which one side has no attacking (but defending) pieces (such as KRK, KCAAEEKAAEE, KHPAAEEKAAEE).
I omit all positions of Elephants of the attacking side which are not in the King's palace. By that I could reduce the index space to 15 times (only 6.6% left) as well as data sizes.
A traditional egtb of all-one-attacker with all configurations of defender (KR*K*, KC*K*, KH*K*, KP*K* - total 324 endgames from 3 to 11 men) may take 3.8 GiB in uncompressed form. With the new design the egtb's size have been reduced to 256 MiB (uncompressed).
So far I have failed to use extra computing to retrieve missing information (took too much time) but succeed on using an extra database (lookup tables). Simply I stored all undetermined positions with their real (determined) scores into lookup tables.
By omitting only some pieces' positions which effect minimum to results, I can keep the size of the extra database be small enough. With lookup tables, instead of 15 times reducing now the egtb + lookup tables sizes are about 420 MiB, a reduction of 9 times in total.
To save more, I discarded data of one side. Thus the egtb + lookup tables could take about 200 MiB in memory (all in uncompressed form). That is just a small space for model computers, especially comparing with 3.8 GiB of the original one. It means you may probe the egtb anywhere in high speed.
By applying some compress methods, at the moment the new egtb takes only 14 MB - very easy to download. It could be easily released with or even embedded directly into engines.
The probing source code (using standard C++ 11) and all-one-attacker egtb (the egtb stored inside the project) could be download under MIT license (almost no restrictions) at:
https://github.com/nguyenpham/FelicityEgtb
Have fun,
/Pham
I have designed and implemented a new Xiangqi egtb (named Felicity egtb) with DTM metric, focusing on reducing its size.
The main idea to reduce sizes is so simple: omit some pieces on some specific positions which effect minimum to results. The missing information could be retrieved later by using extra computing and / or by using cheap extra databases.
By omitting some pieces' positions (ignore them when creating indexes), some different chess positions could share same indexes. The properties of the new egtb differ from traditional ones. Below are interesting:
- one chess position could be indexed into one index only, but one index could be represented for multi chess positions (one to many)
- score of an index could be undetermined
That is why we call the new one as "undetermined" egtb.
For Xiangqi, at the moment the new design could apply for a special class of endgames in which one side has no attacking (but defending) pieces (such as KRK, KCAAEEKAAEE, KHPAAEEKAAEE).
I omit all positions of Elephants of the attacking side which are not in the King's palace. By that I could reduce the index space to 15 times (only 6.6% left) as well as data sizes.
A traditional egtb of all-one-attacker with all configurations of defender (KR*K*, KC*K*, KH*K*, KP*K* - total 324 endgames from 3 to 11 men) may take 3.8 GiB in uncompressed form. With the new design the egtb's size have been reduced to 256 MiB (uncompressed).
So far I have failed to use extra computing to retrieve missing information (took too much time) but succeed on using an extra database (lookup tables). Simply I stored all undetermined positions with their real (determined) scores into lookup tables.
By omitting only some pieces' positions which effect minimum to results, I can keep the size of the extra database be small enough. With lookup tables, instead of 15 times reducing now the egtb + lookup tables sizes are about 420 MiB, a reduction of 9 times in total.
To save more, I discarded data of one side. Thus the egtb + lookup tables could take about 200 MiB in memory (all in uncompressed form). That is just a small space for model computers, especially comparing with 3.8 GiB of the original one. It means you may probe the egtb anywhere in high speed.
By applying some compress methods, at the moment the new egtb takes only 14 MB - very easy to download. It could be easily released with or even embedded directly into engines.
The probing source code (using standard C++ 11) and all-one-attacker egtb (the egtb stored inside the project) could be download under MIT license (almost no restrictions) at:
https://github.com/nguyenpham/FelicityEgtb
Have fun,
/Pham