AlvaroBegue wrote:
That is a problem. Clever code hides bugs. Code should be as clear as possible.
Of course I am guilty of writing clever code myself, but I do make some effort to keep things simple.
The way I handle repetitions is to call a function that checks for repetition and 50-move rule before the recursive call to negamax:
Code: Select all
score = board.draw() ? 0 : -negamax(-beta, -alpha, depth - 1);
My programs detect draws (3-fold repetition, 50-moves rule and lack of material) at the start of the negamax function, ie after the recursive call.
Before or after a function call is not important, but naming such a function with the word "draw" inside is.
I am impressed by the work that is behind Embla, that contains many more things than in Amoeba, like syzygy table support, mysql/sqlite3 opening books, multithreading, etc. But I am also disappointed by the weakness of the engine, that is much weaker than my bare engine
https://github.com/abulmo/Dumb. I am convinced that some bugs or poor implementation are hidden in the code and prevent it to progress.