Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Design: what would your objects be?

Author: Russell Reagan

Date: 13:06:59 07/04/02

Go up one level in this thread


On July 04, 2002 at 08:01:08, Sven Reichard wrote:

>How's your design coming along?

It's coming along, but rather slowly. I'm still kind of learning good principles
of OO design, and so I'm still having trouble deciding where things like legal
move generation belong. So far I have my program narrowed down into about 5
major components:

1. A way to represent a game of chess, it's moves, positions, and a method for
maneuvering between them.

2. A way to determine if a move played was legal.

3. A way to evaluate a position and determine which side is winning and by how
much.

4. A method of analyzing variations so the program will "see" more.

5. A user interface (no matter how simple, IE text/console at first, then
winboard, UCI, etc. later).

Generating legal moves seems to fall under number 4 (which is basically search),
but number 2 also needs to use that to some degree. Maybe I could do something
like:

int depth = 1;
Move move = GetUserMove();
if(search.moveExists(move, depth))
    // then move is legal

Of course I'd need to add in something to make the move and test if the king can
be captured so it determines if the move is 100% legal. Since this isn't time
critical and will only be used once per turn to verify that the actual move
played is legal, I suppose it would be better to add move generation to the
search component and then to satisfy #2 work some method around that (even if
it's inconvienient, because it's not time critical). What do you think?

Russell



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.