user3274: I'm trying to understand how Stockfish thinks, how it calculates the best move.
I'm reading open source code, but it's not clear. I want to know, should I know some theory about algorithms to understand that code? Or is it possible without knowing anything? If there are important algorithms, please tell me what I should learn before reading source code.

user7281: Before starting diving into stockfish why don't you checkout the smallest chess program in C called nanochess by Oscar Toledo. It has only one file main.c  

user18716: TSCP is well commented and a good place to learn how chess programs work
http://www.tckerrigan.com/Chess/TSCP/

user1025: If you are reading the code to become a better player, you won't have much luck. The tricks used are only useful when you have the memory and computational power of a machine. 
If instead you are reading it to learn about chess programming, the following wiki is a great resource https://chessprogramming.wikispaces.com

3274: <p>I'm trying to understand how Stockfish thinks, how it calculates the best move.
I'm reading open source code, but it's not clear. I want to know, should I know some theory about algorithms to understand that code? Or is it possible without knowing anything? If there are important algorithms, please tell me what I should learn before reading source code.</p>
 7281: <p>Before starting diving into stockfish why don't you checkout the smallest chess program in C called nanochess by Oscar Toledo. It has only one file main.c  </p>
 18716: <p>TSCP is well commented and a good place to learn how chess programs work
<a href="http://www.tckerrigan.com/Chess/TSCP/" rel="nofollow noreferrer">http://www.tckerrigan.com/Chess/TSCP/</a></p>
 1025: <p>If you are reading the code to become a better player, you won't have much luck. The tricks used are only useful when you have the memory and computational power of a machine. </p>

<p>If instead you are reading it to learn about chess programming, the following wiki is a great resource <a href="https://chessprogramming.wikispaces.com">https://chessprogramming.wikispaces.com</a></p>
