https://www.chessprogramming.org/index.php?title=CPW-Engine_recognize&feed=atom&action=history
CPW-Engine recognize - Revision history
2024-03-28T22:34:51Z
Revision history for this page on the wiki
MediaWiki 1.30.1
https://www.chessprogramming.org/index.php?title=CPW-Engine_recognize&diff=9318&oldid=prev
GerdIsenberg: Created page with "'''Home * Engines * CPW-Engine * Recognizer''' <pre> #include "stdafx.h" int is_rim[64] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,..."
2018-12-18T14:33:02Z
<p>Created page with "'''<a href="/Main_Page" title="Main Page">Home</a> * <a href="/Engines" title="Engines">Engines</a> * <a href="/CPW-Engine" title="CPW-Engine">CPW-Engine</a> * Recognizer''' <pre> #include "stdafx.h" int is_rim[64] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,..."</p>
<p><b>New page</b></p><div>'''[[Main Page|Home]] * [[Engines]] * [[CPW-Engine]] * Recognizer'''<br />
<br />
<pre><br />
#include "stdafx.h"<br />
<br />
int is_rim[64] = {<br />
1, 1, 1, 1, 1, 1, 1, 1,<br />
1, 0, 0, 0, 0, 0, 0, 1,<br />
1, 0, 0, 0, 0, 0, 0, 1,<br />
1, 0, 0, 0, 0, 0, 0, 1,<br />
1, 0, 0, 0, 0, 0, 0, 1,<br />
1, 0, 0, 0, 0, 0, 0, 1,<br />
1, 0, 0, 0, 0, 0, 0, 1,<br />
1, 1, 1, 1, 1, 1, 1, 1<br />
};<br />
<br />
<br />
/* please note that this recognizer assumes that the position is legal,<br />
i.e. side to move is not in check */<br />
<br />
int isDraw() {<br />
<br />
/* no pawns */<br />
if (!b.PawnMaterial[WHITE] && !b.PawnMaterial[BLACK]) {<br />
<br />
/* both sides have at most one minor piece - to guard against the possibility<br />
of a helpmate in the corner, we do not claim an immediate draw if the king<br />
of the weaker side stands on the edge of the board */<br />
<br />
if (b.PieceMaterial[WHITE] < 400 &&<br />
b.PieceMaterial[BLACK] < 400 &&<br />
(!is_rim[b.KingLoc[WHITE]] || b.PieceMaterial[BLACK] == 0) &&<br />
(!is_rim[b.KingLoc[BLACK]] || b.PieceMaterial[WHITE] == 0)<br />
)<br />
return 1;<br />
<br />
}<br />
<br />
/* default: no draw spotted */<br />
return 0;<br />
}<br />
</pre><br />
'''[[CPW-Engine|Up one Level]]'''</div>
GerdIsenberg