4

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.

Brian Towers
  • 96,800
  • 11
  • 239
  • 397
  • 1
    what exactly is not clear. You would be surprise, but playing chess requires non-intuitive algorithm. Yes you need to know something about algorithms to understand complicated algorithms and also you need to understand artificial intelligence (another surprise) – Salvador Dali Jun 13 '14 at 09:10
  • I like surprises )) it's interesting, thanks i'll read about it. – Digmadentia-Ars Jun 13 '14 at 09:30
  • 1
    take a look at this book (I read it and in my opinion it is good). http://www.amazon.com/Artificial-Intelligence-Modern-Approach-Edition/dp/0136042597 and about this algorithm which is used in chess http://en.wikipedia.org/wiki/Alpha%E2%80%93beta_pruning but also in huge amount of other AI tasks. – Salvador Dali Jun 13 '14 at 10:08

3 Answers3

6

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

Thomas Ahle
  • 881
  • 9
  • 8
  • I'm programmer, so i know that men can't calculate like computer )) It's interesting for me, how programs can examine positions, also this'll improve my knowledge about programming (by reading code). Thanks for answer. – Digmadentia-Ars Jun 13 '14 at 07:43
2

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

john k
  • 121
  • 2
1

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

daparic
  • 415
  • 4
  • 11