Question about history moves

Code, algorithms, languages, construction...
Post Reply
Steffo
Posts: 3
Joined: Wed May 31, 2023 9:08 pm

Question about history moves

Post by Steffo » Wed May 31, 2023 9:33 pm

Hi,
I'm watching the Youtube-Tutorial of the BBC chess engine and on one episode, he talks about history moves and in my C++ code, which is structured differently, it actually takes much longer to calculate with history moves. In fact, beginning at depth 8, it's like an infinite loop.

Here is what the BBC engine has developed:

Code: Select all

static inline int negamax(int alpha, int beta, int depth)
{
       // code generation and evaluation...

       // found a better move
        if (score > alpha)
        {
            // store history moves
            history_moves[get_move_piece(move_list->moves[count])][get_move_target(move_list->moves[count])] += depth;
        }       
 }
In fact, this deviates what Chess Programming wiki suggests: Namely to only look at non-capture moves. But even if I do that, the calculation takes simply too long!

My history move code can be found here.

And here is the test I use (PreventPotentialMateIn5ForWhitePart1).

Has anyone an idea why history moves doesn't work for me? I'm grateful for any help!

Btw.: I'm using Google Test. So you need this in order to be able to execute the test.

Cheers,
Steffo

Steffo
Posts: 3
Joined: Wed May 31, 2023 9:08 pm

Re: Question about history moves

Post by Steffo » Thu Jun 01, 2023 7:53 pm

Update: I checked other source codes and tried out examples from a tutorial: Well, as it turns out, history moves is working with the example from the tutorial, but it fails greatly in my mate in 5 examples. So I will just turn off this feature. I couldn't even find this either in Stockfish.

Steffo
Posts: 3
Joined: Wed May 31, 2023 9:08 pm

Re: Question about history moves

Post by Steffo » Fri Jun 02, 2023 11:33 pm

Another update: The problem was actually that I was not using stable sort when I scored the moves.
History moves is actually working good!

Post Reply