Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Newbie Question: Alternatives To Updating Possible Moves by Brute Force

Author: Andrew Williams

Date: 15:56:28 09/01/02

Go up one level in this thread


On September 01, 2002 at 18:37:57, Kip Werking wrote:

>Hello - I am a newbie who just joined.  I have three questions:
>
>1. I am sure many people have thought of this before, but there must be faster
>ways to updating lists of legal moves, other than using brute force.  Obviously,
>the program would not check every possible square, but only a list of pieces.
>My question is: would it be faster to set flags for each piece, and only update
>a piece's list of possible moves if one of the flags has been tripped?
>
>For example, if an h pawn moves, it seems almost silly to have to update the
>list of possible moves for a knight on the a column, and simply check to see
>whether or not the list of moves for the knight needs to be updated, and if not
>(as in this case), know that the list of moves has not changed.
>
>Do programs already do this?  Or is this inefficient or even incoherent in some
>way that I do not realize?
>

Sounds like an interesting idea. Remember you need to take account of *two*
moves. ie if you're generating for white, you need to consider both what black
just did and what white did before that. Unless of course you're generating all
moves for both at every level in the tree, which might be rather inefficient
unless you're using this information to do something clever which makes the
inefficiency worth it.


>2. I am writing a C++ library for playing chess.  I am a complete C++ amateur
>(this is my first real OOD program) and I am sure that my program is inefficient
>in many ways.  I am sure that someone must have already written an almost
>standard library that has optimum efficiency!  Where could I find such a
>library, if only to compare with my own and learn from it?
>

I'm not aware of any libraries that claim to be "optimal". I think that would
depend on the data structure you use for board and moves, and what you hope to
do with the data structure. There are plenty of example programs around: Search
google for: gerbil, TSCP, crafty etc.


>3. It seems to me that static board evaluations' accuracy depends upon the
>"volatility" of the board.  By this I mean that if the board:
>
>has few pieces
>the pieces protect each other
>strong pieces (king and queen) are not exposed
>
>Then the value returned by a static evaluation function (that did not consider
>volatility) would tend to return more accurate results than for boards that:
>
>have many pieces
>the pieces are not protected
>the pieces are exposed
>
>This is simply because there is more room for the value of a volatile board to
>change after the horizon (on the next move) than for a less volatile board.  My
>question is: do programs already consider board volatility?  Is this a
>worthwhile concept?

What you're describing sounds like what we call quiesence. Essentially, we don't
accept an evaluation score unless there are no captures pending for the side to
move. If there *are* captures pending, we continue searching the tree until we
find a position where all captures have been exhausted. What I've described is a
simplification of what can be a very complex process.

Good luck,

Andrew



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.