“bloop” evaluation functionsandiway/csc483/task4/nation.pdf · “bloop” evaluation function...
TRANSCRIPT
“Bloop” evaluationfunction
10/22/07By: Zach Nation
Lines of code: 1,159Total hours: ~55
Disclaimer
The numbers produced are a littleinaccurate due to my dysfunctionalbitboard implementation.
More methods of getting anaccurate evaluation will becomeavailable to me (and will beimplemented) when that isfinished.
The Evaluation Function // first, sum piece value double value = 0.0; int i; for (i=0; i<12; i++) { // for each piece type, multiply the value of that piece // times the number of instances value += pieceValues[i] * (double) countPieces(board[i]); } // weight the piece value sum // against the total piece count // (being up a piece is worth more // when there are fewer pieces total) value /= (double) countPieces(occupied()); // count the number of possible captures for each side // add the difference of (white - black)/total to value // similar to the "mobility" function unsigned long long wMoves = getAllMoves(WHITE); unsigned long long wCaptures = wMoves & black(); unsigned long long bMoves = getAllMoves(BLACK); unsigned long long bCaptures = bMoves & white(); int wCapturesNum = countPieces(wCaptures); int bCapturesNum = countPieces(bCaptures); if (wCapturesNum + bCapturesNum != 0) { double ratio = countPieces(wCaptures) - countPieces(bCaptures); ratio /= (double) (countPieces(wCaptures) + countPieces(bCaptures)); value += ratio; } return value;
Results
1.1 ?unclear16
0=15
-0.5 (too low)=14
0 (slightly high)=/+13
0 (slightly high)=/+12
0 (slightly low)+/=11
1 (too high)+/=10
0.467742 (wrong)-/+9
-0.25-/+8
1+/-7
0.6+/-6
0.1875+/-5
-0.47931-+4
-1-+3
0.375+-2
3+-1
Evaluation Function ResultLevon’s verdictBoard Position #