Author: Uri Blass
Date: 06:24:49 06/16/05
Go up one level in this thread
On June 16, 2005 at 07:47:35, Andrew Dados wrote: >On June 15, 2005 at 15:45:48, Dann Corbit wrote: > >>On June 15, 2005 at 15:26:17, Dan Honeycutt wrote: >>[snip] >>>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; >>>} >> >>It might return a false positive (e.g. two same square-color bishops) but that >>should not be a problem. A false negative (e.g. two knights for one side >>actually can win) is far worse. > >One slight problem here: >[D]k7/8/NKnQ4/8/8/8/8/8 w - - >mate in 2: Qb8+ Nxb8 Nc7# >(well, accidentally Qf8 is also M2 ). > >-Andrew- Right Here is movei's code to claim draw by insufficient material(it detects KN vs K KB vs K and KB vs KB when the bishops control the same squares as draw. The function is function to detect draw and 10000 is the number for draw by insufficient material(it also detect draws for other reasons). the board has squares 0-63 a1=0,h1=7 h8=63 if (numpieces<=3&&valuepieces==3) return 10000; if ((numpieces==4)&&(numbishops[LIGHT]==1)&&(numbishops[DARK]==1)) if (((bishops[0][0]&1)==(bishops[0][1]&1))== ((bishops[0][0]&8)==(bishops[0][1]&8))) return 10000; Uri
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.