I created a Xiangqi Chinese Chess Engine. I asked a Chinese player rated around 2200 to play against it, and he said it plays around 2000 elo level at a depth of 5, and its playing strength is around a grandmaster level around depth of 14 (takes around 2-3 seconds to get a depth of 14 on my desktop computer). I named the engine after the ancient Xiangqi classic "Secret of the Orange".
It uses a basic NNUE model trained on a basic handcrafted piece square tables evaluation (based on a handcrafted evaluation function from https://github.com/maksimKorzh/wukong-xiangqi). The NNUE supports SSE and AVX2 SIMD instructions. The NNUE is a 2-layer neural network model with a (2x2430)-> 128 -> 1 structure (sorry if I get the terminology wrong). NNUE model is around 0.6 MB, an extremely small neural network that runs almost as fast as a handcrafted evaluation.
It does not handle perpetual check/chasing rules correctly.
It is a non-bitboard Xiangqi engine. It uses a "bit-rows" and "bit-columns" design, where instead of using 128-bit bitboards, it uses 10 "bit-rows" and 9 "bit-columns" to represent the board and handle sliding pieces. On Perft Tests, this design is at least 1.5-2.0x faster than what is found in Fairy-Stockfish/Pikafish Xiangqi Engines, depending on hardware.
Orange Xiangqi Chinese Chess Engine
https://github.com/danieltan1517/orange-xiangqi
I built my own little trainer for my engine. I wanted to challenge myself to learn how NNUE works and write the neural network code myself. https://github.com/danieltan1517/xiangqi_pytorch.
Thank you very much to Maksim Korsch for inspiring me to write this engine. I loved watching Maksim's series about building a chess engine as well as his series on building a Xiangqi Engine. I learned a lot from him. https://github.com/maksimKorzh/wukong-xiangqi
Orange Xiangqi Chinese Chess Engine
Moderator: Ras
-
- Posts: 3
- Joined: Fri Nov 03, 2023 8:39 pm
- Full name: Daniel Tan
-
- Posts: 6259
- Joined: Sun Jan 10, 2010 6:15 am
- Location: Maryland USA
- Full name: Larry Kaufman
Re: Orange Xiangqi Chinese Chess Engine
How does it compare to whatever is the best Xiangqi engine now? What is the state of the art there; in both chess and shogi the top engine is a thousand or more elo above the top human; is this also the case in Xiangqi or are the best engines only around the level of the top humans?
Komodo rules!
-
- Posts: 3
- Joined: Fri Nov 03, 2023 8:39 pm
- Full name: Daniel Tan
Re: Orange Xiangqi Chinese Chess Engine
This Xiangqi Engine is mainly a personal hobby project. This is a project to help me understand AI minimax search algorithms and neural networks.
Compared to other engines, still extremely weak. But hopefully with better training and improvements to search, I hope to improve its playing strength. Loses consistently against ElephantEye https://github.com/xqbase/eleeye. Though if I add 4 threads to my engine, it could sort of hold against ElephantEye.
The most powerful open source Xiangqi Engine I am aware of is Pikafish https://github.com/official-pikafish/Pikafish. Pikafish is a fork of Fairy Stockfish that attempts to fully implement Xiangqi repetition rules correctly. This engine's playing strength is way below that engine.
The most powerful Xiangqi engines I believe are still largely proprietary, like Cyclone or XieXieMaster. From what I could gather, Pikafish most likely has a higher playing strength than XieXieMaster. HGM had a list of best Xiangqi Engines: https://home.hccnet.nl/h.g.muller/XQucci.html.
I'm not an expert in Xiangqi engines.
Compared to other engines, still extremely weak. But hopefully with better training and improvements to search, I hope to improve its playing strength. Loses consistently against ElephantEye https://github.com/xqbase/eleeye. Though if I add 4 threads to my engine, it could sort of hold against ElephantEye.
The most powerful open source Xiangqi Engine I am aware of is Pikafish https://github.com/official-pikafish/Pikafish. Pikafish is a fork of Fairy Stockfish that attempts to fully implement Xiangqi repetition rules correctly. This engine's playing strength is way below that engine.
The most powerful Xiangqi engines I believe are still largely proprietary, like Cyclone or XieXieMaster. From what I could gather, Pikafish most likely has a higher playing strength than XieXieMaster. HGM had a list of best Xiangqi Engines: https://home.hccnet.nl/h.g.muller/XQucci.html.
I'm not an expert in Xiangqi engines.
-
- Posts: 3
- Joined: Fri Nov 03, 2023 8:39 pm
- Full name: Daniel Tan
Re: Orange Xiangqi Chinese Chess Engine
I am not sure whether Xiangqi engines are above top humans. I don't know exactly. Though I wouldn't be surprised. I heard Pikafish was rated around 3500 elo or something like that. So it is most likely the case.