Author: Mathieu Pagé
Date: 01:15:40 08/01/04
Go up one level in this thread
On August 01, 2004 at 01:07:10, Uri Blass wrote: >My code until today used a lot of global varaibles and I decided based on advice >of Dann Corbit to use a class for time management. > >I have a many varaibles in class for time management and >I hesitate which parameters to give to the functions. > >I will give an example: > >I want to have a procedure to update the remaining number of moves to the time >control in the beginning of every search(this varaible is used for other >varaibles like the target time. > >The procedure is using the following varaibles: >1)num_moves_1(number of moves in the first time control) >2)num_moves_2(number of moves in the second time control) >3)num_moves_3(number of moves in the third time control) >4)hply(history ply of the game) > >I think to call the procedure not inside the class so it cannot get directly >num_moves_1 or num_moves_2 or num_moves_3 > >I can write seperate functions to return num_moves_1 inside the class and use >these functions outside of the class but I am not sure if it is a good idea(no >experience in C++). > >Another possibility is not to give the functions the parameters of >num_moves_1,num_moves_2,num_moves_3 because their value is known inside the >class so it is not needed. > >What do you suggest? > >Uri If the methode is one of the class, you should not give it the parameters since it already have them. You can even never send out thoses variables if they are only needed by mothodes of your classes. This would make your class way way easier to maintain and debug since all the possible error will be limited to this class. However this is not always possible/efficient. Mathieu P.
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.