Alexandr Novikov wrote:i think i have good move generator. my program analyzes over 2 000 000 positions per second on my core i7 in single mode. i used mac mashine with parallels desktop for chess programming
At this stage the speed of your move generator is irrelevant. Is it bug free? Write a perft function to find out!
Henk wrote:I remember a teacher at school having trouble with explaining code of towers of Hanoi problem.
That's completely off topic. The towers of Hanoi don't even have to do with recursion.
Just move the smallest piece counterclockwise when the number of pieces is even (clockwise when the number of pieces is odd) every 2nd move and make the only possible move that does not involve the smallest piece every other move.
On the other hand, the first time I solved the towers of Hanoi, I did it recursively.
There is a wonderful dialog on the towers of Hanoi in Sedgewick, and he shows how the solution to this problem can also be used for such things are marking the increments on a ruler properly.
Alexandr Novikov wrote:Variable depth is ply in my code?
In this code example "depth" means remaining depth until horizon. In your code "ply" means the distance from root to current node. When starting search at the root with depth=5, initially you are at ply=0. After making one move you are at ply=1, and you (normally) search its subtree with depth=4. Another three plies later you are at ply=4 and search with depth=1. Etc. I wrote "normally" since you might decide to search the current node to a higher or lower depth (this is for later).
Alexandr Novikov wrote:i not used perft, but i'm sure, that my move gen bugs free on 99 percent.
Are you willing to take a bet where I give you $10 if your code is correct and you give me $1000 if it's buggy?
$990 would be fair
Of course he will take the bet, after having implemented perft it will become an easy $10 gain ...
@Alexandr: We all seriously suggest not to go on without verifying your move generator using perft. The 1% uncertainty will most probably show some en passant, castling, promotion, or legality problem in some "very rare" cases. Unfortunately that would affect the quality of your search as well, not only due to possible illegal moves (or not all legal moves) and getting wrong results but also in terms of performance (for instance if you search too many replies to a check - this could easily lead to a search explosion).
Alexandr Novikov wrote:Variable depth is ply in my code?
In this code example "depth" means remaining depth until horizon. In your code "ply" means the distance from root to current node. When starting search at the root with depth=5, initially you are at ply=0. After making one move you are at ply=1, and you (normally) search its subtree with depth=4. Another three plies later you are at ply=4 and search with depth=1. Etc. I wrote "normally" since you might decide to search the current node to a higher or lower depth (this is for later).
I differ a bit. ply = 1 is the root of the tree, where depth=5. By the time I get to ply=5, depth = 0 and that is the last full-width ply of search, next call will be to quiesce rather than search....
IE a move at ply=1 takes me to ply=2, with that move being the FIRST move I search...
Alexandr Novikov wrote:Variable depth is ply in my code?
In this code example "depth" means remaining depth until horizon. In your code "ply" means the distance from root to current node. When starting search at the root with depth=5, initially you are at ply=0. After making one move you are at ply=1, and you (normally) search its subtree with depth=4. Another three plies later you are at ply=4 and search with depth=1. Etc. I wrote "normally" since you might decide to search the current node to a higher or lower depth (this is for later).
I differ a bit. ply = 1 is the root of the tree, where depth=5. By the time I get to ply=5, depth = 0 and that is the last full-width ply of search, next call will be to quiesce rather than search....
IE a move at ply=1 takes me to ply=2, with that move being the FIRST move I search...
That is for Crafty, though, while most others start with 0 at the root. And I guess in the example above you are at depth=1 (not 0) when you get to ply=5.