New issue 44 by protonspring: illegal moves vs insufficient material
http://code.google.com/p/gray-matter/issues/detail?id=44
GM thinks it's OK to put itself into
check to take a piece forcing a draw
for insufficient material.
(GM thinks the game ends for insufficient
material before it realizes that the
next move kills the king)
setboard 5K2/8/8/4qn2/8/8/8/4k3 b - - 0 1
In this example, gray should be able to find the
easy mate, but it can't. . I think because it
thinks Q to e7 results in a draw (before it
realizes that this is a win). To fix it we'd
have to analyze every position more thoroughly,
but I don't think this is a good idea either
(it is very very slow).
fixed in revision 1603
Comment #3 on issue 44 by protonspring: illegal moves vs insufficient
material
http://code.google.com/p/gray-matter/issues/detail?id=44
In the board state method, instead of asking if the KINGs were attacking
each other, I just test if a king can be taken in any way. This should
result in the same, but also let us know if a move leaves us in check.
Because now this test happens BEFORE we test for insufficient material, GM
is a little smarter about it, and it doesn't take any more time.
I also added a few other speed optimizations I noticed.
Comment #4 on issue 44 by protonspring: illegal moves vs insufficient
material
http://code.google.com/p/gray-matter/issues/detail?id=44
Reopening. My previous fix caused GM to not be able to find many mates.
Comment #5 on issue 44 by protonspring: illegal moves vs insufficient
material
http://code.google.com/p/gray-matter/issues/detail?id=44
(No comment was entered for this change.)
Comment #6 on issue 44 by protonspring: illegal moves vs insufficient
material
http://code.google.com/p/gray-matter/issues/detail?id=44
OK. Fixed.
Before we check for insufficient, we check if the onmove king is in check.
If so, the move we just made is illegal.