Apr 13, 2007

[Other] Some restructuring

I have taken a look at the different ways I could handle the extensions and it is a complete mess. :)

Currently the search is doing an inCheck at the beginning of each node to determine if we should extend for check. That inCheck is then used by null-moves and futility pruning for the current position.

After that futility pruning does another inCheck to determine if the next position will be in check, this is also done by the late move reduction.

So the worst case scenario does three inCheck lookups for one node. Which is just bad.

I have had a 'history'-array for quite some time that keeps track of passed castling rights, en passant squares and the fifty moves rule. Recently I extended that idea by adding another array that kept track of passed zobrist keys and captures to make the unmakeMove faster.

So basically there already is a stack keeping track of passed positions, only that it lacks information about inCheck and it does not remember what moves was made (only if they were a capture or not).

I am going to complete the stack with the needed information and make the inCheck while making each move so we always have that information.

I do not expect this to speed up the search that much, however the code will be much easier to modify which in turn will help make everything faster.

1 comment:

Anonymous said...

The rapid progress of your engine keeps stunning me. I especially like the way your engine handles trapped pieces. As it plays so much better than mine now, I can hardly give you any useful advice; however, it appears to me that the positional boni are too high and/or the pawn value too low, so Mediocre is a little quick at sacrificing pawns when playing against more "simple-minded" engines; this may occur more often against stupid engines than against older versions of Mediocre.

By the way, I enjoy reading your code, as it is very well organised and commented. Thanks a lot!