Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: AI cleanup Version 3
Home

[Freeciv-Dev] Re: AI cleanup Version 3

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>
Cc: Raahul Kumar <raahul_da_man@xxxxxxxxx>, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: AI cleanup Version 3
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 5 Jan 2002 23:21:15 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, Jan 05, 2002 at 09:58:06PM +0100, Petr Baudis wrote:
> Dear diary, on Sat, Jan 05, 2002 at 09:40:32PM CET, I got a letter,
> where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> > On Sat, Jan 05, 2002 at 07:17:52PM +0100, Petr Baudis wrote:
> > > Dear diary, on Sat, Jan 05, 2002 at 06:37:09PM CET, I got a letter,
> > > where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> > > > On Sat, Dec 29, 2001 at 06:04:32PM +0100, Petr Baudis wrote:
> > > > > >  int find_something_to_kill(struct player *pplayer, struct unit 
> > > > > > *punit, int *x, int *y)
> > > > > >  {
> > > > > > -  int a=0, b, c, d, e, m, n, v, i, f, a0, b0, ab, g;
> > > > > > +  int a=0, b, min_turns_to_dest, d, e, move_rate, n, v, i, f, a0, 
> > > > > > b0, ab, g;
> > > > > Ble - can you please put them at least to separate lines?
> > > > 
> > > > > min_turns_to_dest seems too long for me - what about 'delay'? ;) 
> > > > > (used that
> > > > 
> > > > This is a bit funny. One char names are too short and 17 char names
> > > > are too long. Hell he didn't wrote minimal_turns_to_reach_destination
> > > > like I would have done ;).
> > > lol ;)
> > > 
> > > Well, if there is equally appropriate short name, why should we use the
> > > long one? ;p
> > 
> > Because is was quite hard to decipher the AI code. I just don't want
> > to loose the knowledge the people have gained in the last month again.
> Well, if there is a doubt about the mean of the variable, there should be a
> comment near its declaration. The variable name should just represent its
> content, not explain it, IMHO.

So what would you prefer:

int d;
int d; /* minimal number of turns to reach the destination (dest_x,dest_y) */
int delay;
int delay; /* minimal number of turns to reach the destination (dest_x,dest_y) 
*/
int t;
int t; /* minimal number of turns to reach the destination (dest_x,dest_y) */
int turns;
int turns; /* minimal number of turns to reach the destination (dest_x,dest_y) 
*/
* int min_turns_to_dest;
int min_turns_to_dest; /* minimal number of turns to reach the destination 
(dest_x,dest_y) */
int minimal_turns_to_reach_destination;
int minimal_turns_to_reach_destination; /* minimal number of turns to reach the 
destination (dest_x,dest_y) */

I like * best. You have the unit (turns) and also a short description
of what is measured. And you don't have to provide a comment.

There was a person (sorry no name available) which wanted that every
local variable has a comment on it (like above).

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
    1) Customers cause problems.
    2) Marketing is trying to create more customers.
  Therefore:
    3) Marketing is evil.


[Prev in Thread] Current Thread [Next in Thread]