Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: chess programming question

Author: Roberto Waldteufel

Date: 01:58:40 12/29/98

Go up one level in this thread



On December 29, 1998 at 02:29:41, Jeff Anderson wrote:

>I've begun working on a chess program, and am in the very early stages.  I have
>come up with an idea, or a shortcut, but I fear it may have some negative
>consequences.  In my numerical representation of the chess board, instead of
>having for example 1 for a pawn, 2 for a knight, 3 for a bishop 4 for rook, 5
>for queen, 6 for king, -1 for black pawn and so on, could I not make the
>numerical representation of the piece its value?  For example instead of 2 for a
>knight, the knight could be 300, and a black knight could be -300.  The white
>bishop might be 320 and the black king -5000 and so on.  Would this not kill two
>birds with one stone, and save me the trouble, of assigning the piece values
>another place?  It would make the evaluation much easier, because all I would
>have to do is add up the total value of each element in the board array (not
>counting positional considerations).
>Jeff

Yes you can do this, and it works (I used something very similar in my earliest
attempts at chess programming), but as you suspect there are cons as well as
pros. Any time you need to step through all piece types (eg for correct ordering
of captures), it is easy to code "for piece=1 to 6.....etc", but not so easy
when your pieces have different values. Also, do you not intend to use
piece-square tables to give a value for each type of piece for each side for
each square? I found piece-square tables very useful, but then it no longer
makes any sense to assign a fixed value to each piece. Having said this, you
must do whatever works for you, as long as you start with your eyes open to both
the positive and negative aspects of your chosen approach.

By the way, you should be updating things like material balance incrementally
through the search - it's much more efficient than summing over all the pieces
at the tips. Just add or subtract the appropriate value whenever a capture or
promotion is made/unmade, and then at the tips you already have your material
balance ready for inclusion in the evaluation function.

Good luck with your program

Roberto



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.