SeireiWolf
User
 Junior Member
| Posts: 18 |   | Karma: 0
|
re:Object-Oriented Chess Program - 2006/08/19 11:04
"Harumpel" wrote oriented programming offers many benefits. The main benefits that I like is that you can create a program that works, with relatively few (if any) bugs, you can make significant changes in the program without too much headache, and you can develop your program in less time. What does this mean for chess programming? It means that you have more time to work on new ideas. It means that once you come up with a new idea, you can add that new idea to your program without having to rewrite half the code. You can do better testing of your modules to make sure they work correctly. This basically means that you have more time to experiment with new ideas you have for making your program stronger, and in the long run, that will give you a better chess program than if you wrote it all in assembler and it was insanely fast. Think about it for a moment. Speed isn`t the number one thing to strive for in a chess program. Let me give you an example. Let`s say you have a program that you wrote in a non-object oriented manner. It searches using the well known techniques. It can search a million positions per second, and has a branching factor of about 3 (the best in the world are between 2 and 3). Now let`s say that I have a program that has all of that same well known stuff in it (plus a little more), but my program does a whole lot of object oriented stuff and it much slower than yours. My program only searches 100,000 positions per second, but I had extra time to spend thinking about and testing new ideas for pruning methods. As a result of my extra thinking and testing of ideas, my program has a branching factor of 2.5. Your program will search 14 plies ahead in about 4.7 seconds, and my program will search 14 plies ahead in 3.7 seconds. In a game at a standard time control, your program will be able to see a little more than 17.3 ply ahead during each move (at say, 40 moves in 2 hours time control). My program will be able to see about 18.2 plies ahead in that same time, even though it is 10 times slower than yours. The point is that speed isn`t the number one goal in making a chess program. In reality, my program might be only 10% slower than yours if it`s totally object oriented and uses lots of dynamic things such as virtual/abstract base classes and dynamic memory allocation and so on. If my program was only 10% slower, then it would kill your program. So maybe you need to rethink your statement than using object-orientation in a chess program does not make any sense. IMO, not using it doesn`t make much sense, because you can always use OOP to get done quicker and test new ideas, then once you find out new ideas that work, you can write them in C with assembler if you`d like (because you`ll have more time left to do this kind of thing). Not to mention that you can inline most of your object oriented stuff anyway, and it won`t be any slower. You can write in an object oriented way without sacrificing speed, and still get many of the benefits of OOP. I bet when you think of "object oriented" you think of C++ or Java, but the truth is that you can write in an object oriented (or "modular" if you prefer) style in almost any language. In some languages it would slow you down because of extra function calls (even though this would be very little of a slow down) but in C/C++ you can inline your code, and suffer no penalty, and get all of the benefits of OOP. ---------
The first two facts which a healthy boy or girl feels about sex are these: first that it is beautiful and then that it is dangerous.
Popular posts by SeireiWolf When is the next winboard coming ou... Positional vs Tactical Engines chess algorithms
|