Author: Sune Fischer
Date: 03:46:40 07/03/02
Go up one level in this thread
On July 03, 2002 at 05:37:11, Daniel Clausen wrote: >I my case, I have: > >(a) Class Board >Contains information which piece resides on which square, but also contains >information about en-passant, castling state etc. I guess I could have called >the class 'Position', I just somehow prefer 'Board'. > >(b) Class Game >Has Board as a member variable, along with other information about a played >game. For example it contains information about time limit for both sides and >player names. It also contains a move list, which contains all played moves so >far. (therefore you can undo a move on a game-object, but not on a board-object) > >Sargon Did you describe your program or mine? :) Except for the Game class, which I call Tree class, then I recognize it all :) There are a few things though, I'd like to hear how you've solved them. TimeControl() - do you have a special class for that, if so why, what should I do with a time object when I just need to pick the time? FirstOne() - to read the first bit off a bitboard, where should I put this when I don't have a BitBoard class (and I don't see how to make one)? SetupMisc() - things like hash, killer and history tables, flags for communication and all kinds of things. It doesn't really belong anywhere IMO. isDraw() - checks for repetition (needs the Tree) and checks for material (needs the Board). Should I make a special evaluation class, seems it would always and only depend on the Board. ProbeHash() - should the hash be an object, it needs a Board. Moves... - been discussed, its also a hard one, lots of move type functions, but MakeMove is really more of a Board type function IMO, although it is also one of the things that will get stuck between two classes. Then there are things such as reading from the book which requires knowledge of the Board or Tree, but shouldn't it have a class of its own when the book is a true object, albeit just a FILE pointer? One of the things I always get stuck with in this OOP is that some things feel like they should be put into their own class, but there is never any use for an object of the class, other than to call those functions. For instance I have functions to make random numbers, to convert ASCII characters, that sort of simple things. I wouldn't know what to do with a 'random' object, I just need the random number, not the object. It means I first must declare a random object to get a random number, pretty silly IMO. There are of course more, but all that I can't find a good answer to I make global, it's mixing C with C++, but whatever is the most intuitive to me I use. -S.
This page took 0.01 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.