Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about varaibles that I should give to functions in C++

Author: Uri Blass

Date: 13:04:46 08/01/04

Go up one level in this thread


On August 01, 2004 at 07:24:34, Volker Böhm wrote:

>On August 01, 2004 at 05:28:36, Uri Blass wrote:
>
>>On August 01, 2004 at 04:17:35, Volker Böhm wrote:
>>
>>>Hi Uri,
>>>
>>>I read your questions twice but I am still not sure what you are asking for.
>>>Nevertheless I try an answer.
>>>
>>>The "variables" of the class are called "attributes". The "functions" of the
>>>class are called "members" or "member-functions".
>>
>>I will be more specific and I will use the terms that you mention(I know nothing
>>about C++ and I have only code that Dann Corbit sent me to help me when the code
>>is not new varaibles or new functions but only converting the old code that I
>>used to class).
>>
>>In my case suppose that the time control is 40 moves/120 minutes+20 moves/60
>>minutes+30 minutes/rest of the game.
>>
>>I have num_moves_1=40
>>num_moves_2=20
>>num_moves_3=Infinit(defined to be 9999)
>>
>>I get all this varaibles based on the numbers that I get after the level command
>>Is it logical to use them as attributes when the function of the level command
>>is a member function?
>
>Yes, num_moves_1,num_moves_2,num_moves_3 should be attributes
>The level function is then a method that sets the num_moves
>
>either:
>
>class time
>{
>private:
>int num_moves1;
>int num_moves2;
>int num_moves3;
>public:
>time()
>{
>  num_moves1 = 0;
>  num_moves2 = 0;
>  num_moves3 = 0;
>}
>void level(int moves1, int moves2, int moves3)
>{
>  num_moves1 = moves1;
>  num_moves2 = moves2;
>  num_moves3 = moves3;
>}
>};

My level_command today simply use a string
char buffer[256] when buffer is a global varaible.

It find the relevant varaibles from the string so I do not think that I need
move1,move2,move3 as varaibles for functions unless it is better to have a lot
of function to get a single varaible from the string like

void level_command()
{

level(get_num_moves_1().get_num_moves_2(),get_num_moves_3,get_seconds_1(),get_seconds_2(),get_seconds_3(),get_increasment());
}

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.