3

I am a newbie. I want to code a chinese chess engine, and I want to modify Stockfish source code to do so. But the Stockfish source code is too hard to understand. There are no document to explain everything. I don't know where to start. For example, today I try to understand the bitbase.cpp file. This line of code in this file is not well documented:

constexpr unsigned MAX_INDEX = 2*24*64*64; // stm * psq * wksq * bksq = 196608

I really don't know where to ask questions about these kind of things. It's open source but it seem to be understanded by only few people. Please give me suggestions to understand the source code better. Thanks!

  • Chinese chess is quite different from European chess, is it not? Stockfish is pretty specifically geared towards European chess. – Cort Ammon May 8 at 3:42
  • I think stockfish can be adapted to chinese chess. For example, this project is a UCI Chinese Chess (also called Xiangqi) engine derived from Stockfish 7: github.com/EterCyber/Chameleon – hdvd2309 May 8 at 3:58
3

I believe the line you quote is about probing KPK tablebase endgame. There are 64 squares for the king, and 24 squares for the pawns (mirrored from file A to D). Nothing special, just how Stockfish indexes the bitbase data structure.

The code is not going to work in Chinese Chess for obvious reason.

This line of code in this file is not well documented

No, the line was fully documented. Please look at the code file again.

Please give me suggestions to understand the source code better

In the open source world, if you don't have sufficient coding experience you just can't do anything. You may ask on the Fishcooking forum, but you will still need decent programming experience.

| improve this answer | |
  • Thank you man. I really appreciate your comment! – hdvd2309 May 8 at 12:12
  • 1
    Nit: in the open source world, people with no/weak programming skills still have important roles. Yes, learning to program will help foster active contributions to the code portion of projects (and here it is paramount), but that is not to say “you just can’t do anything.” – D. Ben Knoble May 9 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.