Author: Daniel Clausen
Date: 14:51:21 09/22/03
Go up one level in this thread
On September 22, 2003 at 17:33:35, Bo Persson wrote: >On September 22, 2003 at 15:40:20, Dan Andersson wrote: > >> Polymorphism is considered a cornerstone of OOP. > >Here is where the religious aspects start. :-) > >How do you apply that to a chess game? That is dangerously close to "I never did it therefore it's not possible". :)) One area where polymorphism might be useful is with hashtables. You could have an abstract hashtable and derived classes for the pawn and the normal hashtable. I'm not convinced that polymorhism helps a lot when it comes to the chess pieces, especially not with my other data structures, but there was poster some days ago who described that he's doing that in his engine. Another CCC-member posted more than a year ago, that in his engine, he has an evaluator object which is an observer of a board object. So whenever something happens on the board, the corresponding evaluator object is notified and can do the needed updates. Depending on the "granularity" of the changes of the board-object, this can be rather efficient and very robust. In summary, I think that there's no speed penalty if you use C++ just as a better C. There's a speed penalty when you really use some OO-design, but it doesn't have to be completely slow, depending on how clever you do things. 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.