Basic endgames

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Basic endgames

Post by Sven »

I think your node counts are way too high for these simple endgames. May I assume that you detect K vs K as an immediate draw and return 0?

Independent from that remark, node counters should always be 64 bit integers since 2^32 will be exceeded frequently.

Regarding your king capture scoring, I have to admit that I never developped a "king capture engine" myself but if I did so then I would return a score that differs from normal mate scores by not depending on the current ply count within the tree (e.g. +MATE_SCORE) so that the parent node can detect illegal moves without any doubt. That way, if you always initialize your "best score" with -MATE_SCORE and all pseudo-legal moves return from their subtree with +MATE_SCORE (turned into -MATE_SCORE by negamax), telling you that they were in fact illegal, then you know you are either checkmated or stalemate and can return the appropriate score. I am pretty sure HGM knows an easier way to achieve the same but at least it should work that way.

Also thanks a lot for posting these test positions, that made me aware of a minor but annoying bug that I had introduced recently into Jumbo, leading to being unable to mate quickly with KQK or KRK without EGTB support (it turned out to be a futility pruning problem).
Sven Schüle (engine author: Jumbo, KnockOut, Surprise)
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Basic endgames

Post by Henk »

Already switching over to legal move generation. Simplest solution is best in my case. Especially when you can't even solve simple endgame problems. Or worse not able to win from Fairy-max
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Basic endgames

Post by Henk »

Can't solve this.

[d] 8/4k3/8/R7/4K3/8/8/8 w - -
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Basic endgames

Post by Henk »

Sven wrote: Thu Oct 03, 2019 3:55 pm I think your node counts are way too high for these simple endgames. May I assume that you detect K vs K as an immediate draw and return 0?

Independent from that remark, node counters should always be 64 bit integers since 2^32 will be exceeded frequently.

Regarding your king capture scoring, I have to admit that I never developped a "king capture engine" myself but if I did so then I would return a score that differs from normal mate scores by not depending on the current ply count within the tree (e.g. +MATE_SCORE) so that the parent node can detect illegal moves without any doubt. That way, if you always initialize your "best score" with -MATE_SCORE and all pseudo-legal moves return from their subtree with +MATE_SCORE (turned into -MATE_SCORE by negamax), telling you that they were in fact illegal, then you know you are either checkmated or stalemate and can return the appropriate score. I am pretty sure HGM knows an easier way to achieve the same but at least it should work that way.

Also thanks a lot for posting these test positions, that made me aware of a minor but annoying bug that I had introduced recently into Jumbo, leading to being unable to mate quickly with KQK or KRK without EGTB support (it turned out to be a futility pruning problem).
Looks like can't do futility pruning when ub >= MIN_MATE_SCORE because a check may be a check mate.