the evaluation is made by 3 things:hassenplug wrote:That's pretty cool. I'd be interested to know a couple things:
1) How does it evaluate the board (to determine if a move is "good")
2) How do you plan to distribute the processing across multiple NXTs.
Steve
1st, the "piece balance sheet" before/after the move (considering the balance after all deepenings: it's sort of Alpha-Beta-Search);
2nd, if the opponent is put in check (currently weighted too high);
3rd, some other criteria by this subroutine which evaluates the stationing by very simple criteria (they have to be kept simple not to induce completely wrong stategies in some cases):
Code: Select all
/******************************************************************************/
void Score (char CK, char RK, char &board[]) {
/******************************************************************************/
// scBlackP 104 // score of piece values
// scBlackS 105 // score for strategy (positioning)
// scBlackC 106 // score for check
// scWhiteP 108
// scWhiteS 109
// scWhiteC 110
float pwi,pbl, // sum of piece values
cwi,cbl, // sum of check values
swi,sbl; // sum of strategy values
int n, // current sqr number index
b, // square number
pv, // piece value
piece; // piece type
char WiK, BlK; // flags for king found
cwi=cbl=pwi=pbl=swi=sbl=0;
WiK=BlK=false;
for (n=0;n<120;++n) {
b=board[n]; // square number
piece=b&7; // piece type
if (!(n&0x88)) { // valid square
pv=pvalue[b&piece]; // piece value
if (b&8) { // white
if (pv<0) WiK=true; // King found
else pwi+=pv; // add piece value to score
if ((b&32) && (piece==4)) swi+=1; // bonus for virgin K
if ((b&32) && (piece==6)) swi+=0.6; // bonus for virgin R
if ((piece==1)&&(n<72)) swi+=0.5; // bonus for pawn ahead
if ((piece==1)&&(n<23)) swi+=1; // bonus for pawn at opp.side
if ((piece==1)&& // opening: P in center pos
( ( (n==68)&& (!board[67]))||( (n==67)&&(!board[68]) ) )
&&(board[97]&32)&&(board[98]&32)&&(board[101]&32)&&(board[102]&32))
swi+=2;
if ((piece==3)&&(n<112)&&(n>8)) ++swi; // bonus for knight off 1||8
if ((pv==1)&&(n<8)) swi+=16; // pawn->Queen (+extra Queen piece value)
}
else
if (b&16) { // black
if (pv<0) BlK=true; // King found
else pbl+=pv; // add piece value to score
if ((b&32) && (piece==4)) sbl+=1; // bonus for virgin K
if ((b&32) && (piece==6)) sbl+=0.6; // bonus for virgin R
if ((piece==2)&&(n>47)) sbl+=0.5; // bonus for pawn ahead
if ((piece==2)&&(n>95)) sbl=+1; // bonus for pawn at opp.side
if ((piece==2)&& // opening: P in center pos
(( (n==51)&&(!board[52]))||((n==52)&&(!board[51])))
&&(board[17]&32)&&(board[18]&32)&&(board[21]&32)&&(board[22]&32))
sbl+=2;
if ((piece==3)&&(n<112)&&(n>8)) ++sbl; // bonus for knight off 1||8
if ((pv==1)&&(n>111)) sbl+=16; // pawn->Queen (+extra Queen piece value)
}
}
}
if((CK & 8)) {cwi=-1; }
if((CK &16)) {cbl=-1; }
if (!WiK) {pwi=cwi=swi=-120; } // king capture marker
if (!BlK) {pbl=cbl=sbl=-120; }
board[104]=pbl; board[105]=sbl; board[106]=cbl;
board[108]=pwi; board[109]=swi; board[110]=cwi;
}
on 2 NXTs, it will start the 1st ply search including all follow-up-deepenings on all even fields on the master and on all odd fields on the BT slave.
Having 3 or 4 bricks it will be based on subsets like modulo 3 or 4 so that not 1 brick is supposed to have all the work on the first (or last) 2 ranks at the start.
It waits until all slaves are finished and then it compares the board scores of all subset moves.