Author: Sven Reichard
Date: 05:01:08 07/04/02
Go up one level in this thread
On July 04, 2002 at 06:01:06, Russell Reagan wrote:
>What does your evaluation class look like? You don't have to share
>implementation or some "secret" evaluation factors, but I'm curious how you
>handle an evaluation class.
>
>Russell
Russell,
I don't have any secrets (at least not what chess programming concerns) ; the
evaluation factors are so bad that I wouldn't recommend anyone to copy them. The
positional evaluation is the last major thing that I added; before it was purely
materialistic (i.e., P=1, N=B=3, R=5, Q=9).
I also intend to make the sources available for download in September, just if
anyone is interested.
First of all, some of the information is updated dynamically, i.e., whenever a
move is made. For this reason, the evaluation is a "game observer" - I think I
explained what I mean by that.
The evaluation has a stack containing the material value. At any point the top
of the stack contains the value from the point of view of the color to move. So,
for a non-capturing, non-promoting move I just do
scoreStack.push(-scoreStack.top());
and for other moves I adjust the score correspondingly.
Then there is a method
Score score();
which gives the complete evaluation of the board. Score is typedef'ed to signed
int; I tried making it a class to (to deal with mate scores when going up and
down the tree), but that was too much of a hassle. The materialistic evaluation
just returns the top of the score stack, and is done.
At some point I'll change the signature of this function; I'll add alpha and
beta as parameters to allow for lazy evaluation.
The positional version is still very simple; it has functions like
evaluateCentralization, which gives certain bonuses (boni? :) ) to pieces near
the center of the board. The weights of these bonuses are constants right now,
so something like
enum{PAWN_CENTRALIZATION=15, KING_CENTRALIZATION=-10};
Of course, this should depend on the phase of the game. The function to
determine how central a square is also lives in this class at the moment.
Then there is a function evaluatePawns, which first figures out how many black
and white pawns are on each file. This is used to detect isolated and doubled
pawns, which also give a certain penalty.
The same information is used to push rooks to open or half-open files.
This is basically all so far, and sometimes it lets Alice reach a not totally
lost endgame against GnuChess (at least in my patzer eyes). It always loses that
endgame though, so the next thing in line is detection and evaluation of passed
pawns. I have some ideas of how to do that, and maybe I'll start this weekend.
How's your design coming along?
Sven.
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.