Author: Steven Edwards
Date: 07:02:55 08/29/03
Go up one level in this thread
On August 29, 2003 at 09:31:35, Mathieu Pagé wrote: >>On August 28, 2003 at 02:59:47, Russell Reagan wrote: >>>On August 27, 2003 at 18:55:03, Mathieu Pagé wrote: >It's fine to see that i'm not the only programmer thinking that OO code can be >as fast as non-OO code. Surely, the OO development process is faster. If a designer considers run time speed as the only priority, then coding in assembly language is the only consistent choice. But the resulting losses in portability, ease of feature addition, etc. are too much for my taste. Years ago I wrote chess engines in both Zilog z80 and Motorola 68k and I'm not going back to those bad old days. >I'll try to re-design my code to get it fully OO. of course, I will try to avoid >using base class with virtual functions. Using virtual features can be a good thing, but in a chess program they are not really needed for most of the classes that see high frequency access during search. >I was tinking of using those class: > >CBoard - State of the game, here will be the bitboards > >CGame - keep the history of the game, it will have a CBoard as the current state >of the game. The treefold and 50 moves rules will probably be handled here (or >maybe in CBoard) > >CMove - Keep some information on a move (from, to, type, pieces, piece_taken) > >CEvaluator - this class represent an evaluator that will evaluate the game and >can have some parameters sets to modify is comportment. > >CSearcher - Handle most of the search algorithm (dont know if it will be easy to >get in a class) > >CTimeHandler - A class that will handle the clock (decide when it is time to >move) > >Then i will have lots of other class like: > >CMoveList, CHashTable, CPawnHashTable, CTreeFoldHashTable, COpeningBook (a >wrapper), CEgtb, CPngGame (A single game), CPgnFile (group of games), and lots >of other things. Sounds like a reasonable start. >I'll try (dont know if I'll success) to design this as reusable components. Reusability follows naturally from abstraction and encapsulation. >I'd like to have your opinion on my project. Is it possible, is there some more >class i should have, what are your experience with OOProgramming while working >on a chess engine ? A technique I've found useful is to write some high level task like the a PV/Negamax search before doing much of anything else. If the resulting source is compact and easy to understand, then it is likely that the lower level class specifications are sound.
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.