Author: Uri Blass
Date: 09:53:36 08/10/04
Go up one level in this thread
On August 10, 2004 at 12:01:29, Tord Romstad wrote: >On August 10, 2004 at 10:32:27, Anthony Cozzie wrote: > >>I am thinking about switching Zappa from C to C++, primarily to make it simpler >>and easier to update. I don't think it would take that long (it could be done >>incrementally), and the code would be somewhat cleaner. >> >>Some of it is just a matter of taste: do you prefer >> >>int move; >> >>#define m_f_loc(A) ((A) & 0xFF) >>... >> >>or >> >>class move { >> private: >> int move; >> >> public: >> inline int m_f_loc(void) { return move & 0xFF; } >>} >> >>I am fairly sure these will generate the same assembly. > >They probably would. I prefer the plain C version, though. Chess programs >are typically rather small and simple programs, written by a single person >rather than a big team. The fact that a single person write a program does not mean that it is a simple program. > In other words, it they are precisely the kind >of programs where the advantages of OOP aren't really very important. >There are probably cases in a chess program where using classes would be >slightly more convenient or elegant, but I think the difference is not big >enough to matter much in practice. If I understand correctly you do not have classes. How do you handle time decisions in Gothmog like when to stop the search? When I used C I had global varaibles and I updated them in many places in the search like after finishing the first move and after finishing iteration. I find it as an ugly code when I do not have all the time related functions in one place and this is the reason that I decided to have a file for time and using a class if you have one file for this problem is natural decision. I think that there is room for improvement in time management and it is possible for example to predict during pondering if there is a good chance to fail high on the move that the program is searching and also to give estimate how much time it is going to take in order not to reply immidiatly in case that you expect fail high soon. Crafty does something about it and can use at most twice the target time to finish the move that it is searching but I think that not enough is done and using always twice the time is illogical and it is better to try to predict if there is a good probability to fail high soon. Suppose that you used slightly more than twice of the target time and you have the following table for times 1.d4 d5 started to search 1.4*target time 1.d4 Nf6 started to search 1.5*target time ... 1.d4 h6(h6 latest legal move_ started to search 2.1*target time got move 2.101*target time It may be logical to predict that 1.d4 is going to fail high soon and decide to use more time inspite of the fact that you already used more than twice of the target time. Note that I do not do the smart thing that Crafty does about trying to finish the current move(not first move) when you used more than the target time but less than twice the target time today but I decided that in order to improve time management I need to have all info about time information in one place(otherwise it is harder to think exactly about the meaning of what I do and to change the code without bugs). Uri
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.