Answers.Body: <p>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.</p>
  
  <p>The code is not going to work in Chinese Chess for obvious reason.</p>
  
  <blockquote>
    <p>This line of code in this file is not well documented</p>
  </blockquote>
  
  <p>No, the line was fully documented. Please look at the code file again.</p>
  
  <blockquote>
    <p>Please give me suggestions to understand the source code better</p>
  </blockquote>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-09T02:49:28.193Z
Answers.Text: 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.”
Answers.UserDisplayName: D. Ben Knoble
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-08T10:06:32.387Z
Answers.LastActivityDate: 2020-05-08T10:06:32.387Z
Answers.UserDisplayName: SmallChess
Body: <p>I want to code a Chinese chess engine, and I want to modify the Stockfish source code to do so, but the Stockfish source code is too hard to understand. There is no document that explains everything. I don't know where to start. For example, today I tried to understand the bitbase.cpp file. <a href="https://github.com/official-stockfish/Stockfish/blob/39da50ed23ee3f1bd32a58c8f02471faa9a9fd63/src/bitbase.cpp#L32" rel="nofollow noreferrer">This line</a> of code in this file is not well documented:</p>
  <pre><code>constexpr unsigned MAX_INDEX = 2*24*64*64; // stm * psq * wksq * bksq = 196608
  </code></pre>
  <p>I really don't know where to ask questions about these kinds of things. It's open source but it seems to be understood by only a few people. Please give me suggestions to understand the source code better.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-08T03:42:27.330Z
Comments.Text: Chinese chess is quite different from European chess, is it not?  Stockfish is pretty specifically geared towards European chess.
Comments.UserDisplayName: Cort Ammon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-08T03:58:45.157Z
Comments.Text: 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:
  https://github.com/EterCyber/Chameleon
Comments.UserDisplayName: hdvd2309
Tags: <stockfish>
Title: How to understand Stockfish's source code?
ThreadText: # How to understand Stockfish's source code?
  
  (Asked by: username_0 on 2020-05-08)
  
  I want to code a Chinese chess engine, and I want to modify the Stockfish source code to do so, but the Stockfish source code is too hard to understand. There is no document that explains everything. I don't know where to start. For example, today I tried to understand the bitbase.cpp file. [This line](https://github.com/official-stockfish/Stockfish/blob/39da50ed23ee3f1bd32a58c8f02471faa9a9fd63/src/bitbase.cpp#L32) 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 kinds of things. It's open source but it seems to be understood by only a few people. Please give me suggestions to understand the source code better.
  
  **Tags:** stockfish
  
  > **Comments:**
  > **username_1**: Chinese chess is quite different from European chess, is it not?  Stockfish is pretty specifically geared towards European chess.  
  > **username_0**: 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: https://github.com/EterCyber/Chameleon  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-05-08. Score: 6 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_3**: 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.”  
  
  ---
  
  