Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Problem with Object Oriented Design (programming issue)

Author: Daniel Clausen

Date: 08:45:37 09/16/03

Go up one level in this thread


On September 16, 2003 at 10:57:30, Pat King wrote:

[snip]

>By the way, I DO use abstract piece classes and a lot of the fancy C++ stuff.

:)

I actually thought about using abstract piece classes and derived concrete
classes for pieces but simply couldn't find a useful interface for these
constructs. Things like creating moves etc all need the current board and stuff
like that and I didn't like the circular dependencies at all. Yeah, I could have
something like this:

---
Board    board;
Bishop   piece(E4);
MoveList moveList;

piece.createMoves(board, moveList)
---

But I didn't like that, because it simply doesn't fit my data structure(s). :)

What else could a potential piece-class encapsulate? Colour and type, yes. But
for these 2 things alone, I didn't think it would be worth it. (a simple struct
or just a (signed) int together with abs() and sign() are enough for this)

If you don't mind talking about the internals of your engine, I would like to
know what functionality your piece classes provide.

Sargon



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.