Author: Dan Honeycutt
Date: 12:26:17 06/15/05
Go up one level in this thread
On June 15, 2005 at 13:53:46, Dann Corbit wrote:
>On June 15, 2005 at 10:49:17, Dann Corbit wrote:
>
>>On June 14, 2005 at 11:39:54, Dan Honeycutt wrote:
>>
>>>Thanks Uri
>>>
>>>Looks like this could be some trouble to detect. What do you do to check
>>>insufficient material, any good suggestions?
>>
>>1. No pawns left
>>2. No pieces larger than knight or bishop left
>>3. Maximum of 1 knight for either side
>>4. If more than one bishop for any side, they must be the same color
>>
>>Then we have a draw.
>
>A simple and correct test is:
>1. Are there any pawns left?
>If not, then:
>2. Does anyone have more than 3 points?
>If not, then drawn.
>Otherwise, unknown if drawn or not.
>
>This overlooks some obvious cases, but it is really easy to test for it and is a
>lot better than nothing. It also does not report false draws, which is a
>terrible bug.
Thanks Dann
Does this look right:
int CanWin() {
int can_win = 0;
if (w_pawns || w_queens || w_rooks ||
((w_bishops + w_knights) > 1)) can_win |= 1;
if (b_pawns || b_queens || b_rooks ||
((b_bishops + b_knights) > 1)) can_win |= 2;
return can_win;
}
Best
Dan H.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.