Wednesday, August 24, 2016

None at all said Mr. Prosser

White moves and wins
Until now iCE contained endgame reconizers that help him to decide whether a position with 4 or 5 pieces is drawn or can be won. Those recognizer usually consisted of a set of rules. The rules where built in a way that  a position can be classified as either DRAW or UNKNOWN. UNKNOWN means it can still be a draw but one the recognizer does not know. If he classifies it as DRAW this is certain and search can be terminated in that node. This cuts the tree very nicely because a lot of branches are just cut off. iCE is often reaching max search depth in drawn positions quickly.

In order to not tell false positives (classify a position as DRAW which is not) the recognizer code was very complicated. It had to spot all the exceptions. Even KNNK is not necessarily always a DRAW.

A lot of effort went in to assembling all those rules but now I finally decided to test how much damage it does if I throw them away. And the answer is

None at all.

"By a strange coincidence “None at all” is exactly how much suspicion the ape-descendant Arthur Dent had that one of his closest friends was not descended from an ape, but was, in fact, from a small planet somewhere in the vicinity of Betelgeuse." D. Adams.

So I trowed them out and replaced them by a scaling factor for each endgame type that scales the score towards a draw, sometimes depending on some easy knowledge (e.g. wrong rook pawn). Maybe iCE will play a bit more stupid in endgames but it does not hurt its overall playing strength. So I take the chance to remove 16.000 lines of code (6000 lines real code and 10.000 lines for additional tables that contain positions with exceptions).

A big step towards simplification.

The git protocol

D:\Docs\cpp\ice\ice>git merge eg-simplify
Updating cd74337..3d18b03
Fast-forward
 endgame.cpp |   144 -
 endgame.h   |    23 -
 eval.cpp    |    66 +-
 eval.h      |    52 +-
 evaleg.cpp  |  6044 ++------------------------------
 krkp.h      | 10947 ----------------------------------------------------------
 version.h   |     6 
+-
 7 files changed, 399 insertions(+), 16883 deletions(-)
 delete mode 100644 krkp.h