Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: Safe paths for triremes etc. (PR#1007)
Home

[Freeciv-Dev] Re: Safe paths for triremes etc. (PR#1007)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, rf13@xxxxxxxxxxxxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Safe paths for triremes etc. (PR#1007)
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Fri, 19 Oct 2001 22:17:26 -0700 (PDT)

--- "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx> wrote:
> Actually I think Gregory had it right and if one followed your comments 
> it is liable to confuse the situation far more in the future.
> 

You many not be aware of this, but I have improved the readibility of the code
dealing with movement costs quite a bit. Prior to my patch introducing
RAILROAD_MOVE_COST, SINGLE_MOVE_COST etc the code was very hard to understand.
You have hardly explained why the it will confuse the situation in the future.

> Think of it this way:
> 
> 1) There is a move_cost associated with a move, in this case SINGLE_MOVE.
> 
> 2) You need to compute the cost to move there (i.e. to attack) but you
>    are not allowed to move there, or through there to another tile.
> 
> The convention in the warmap generation is that move_costs are always
> positive, and if you get a negative one it means something special, 
> i.e. case 2 above. There are only a very few special case interactions
> like this in warmap generation. Learn them, don't come up with ways to
> hide them.
>

Quite wrong. Can I introduce you to SEA_MOVE_COST? I don't see how your
comments don't apply equally well to SEA_MOVE_COST. It's impossible to believe
someone fails to understand my quite simple point, so I'll repeat it in the
hope it will sink in. By returning a - SINGLE_MOVE_COST the reader of the code
will believe there is a relationship between SINGLE_MOVE_COST and a negative
version. That is bad! It does not matter if you return a -5, a -6 or whatever.
That point is not
made clear anywhere.

Greg also had this identical problem quoting from an earlier email about
tile_move_cost_ai

The attached patch shows that you understood it correctly.
 The meaning (my guess) of -3 was
 1. Minus sign to distinguish from land moving
 2. 3 == SINGLE_MOVE for sea units

 However you and Raahul are right, property (2) is never used.

That property(2) is the entire reason I requested the change.

 
> This is NOT a special move, it is a regular move that invokes a warmap 
> special convention.
> 
> So you need to indicate clearly that it is a "negative" move_cost so
> people will understand.
> 
> Cheers,
> RossW
> =====
> 
> Aside: about city warmaps ... haven't a clue. But if I spot something
>        I'll pass it on. If I guessed, it would be something to help them
>        plan settler improvements, or rather building a settler to go do
>        some improving, maybe building a trireme to transport a city
>        founder, or building an attack unit to "find_something_to_kill()".
>        It mmight even be used in estimating city_danger, i.e. how far
>        away is an enemy. There are lots of comments about warmaps being
>        munged, or created, as a side effect of previous operations in 
>        code in server/settler.c or ai/adv*.c
> 

City warmaps are not currently used in find_something_to_kill or any of the
others you mentioned so far as I know. Please let us know if you figure it out.

> At 12:28 AM 01/10/17 -0700, Raahul Kumar wrote:
> >
> >--- Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> wrote:
> >>  --- Raahul Kumar <raahul_da_man@xxxxxxxxx> wrote: 
> >> > return -SINGLE_MOVE
> >> > 
> >> > No, no,no. Bad Berkolaiko, Bad! Do not return a negative single move
> >> > cost, this
> >> > is part of the reason I used to believe there was a relation between
> >> > single
> >> > move cost and the sea move cost.
> >> > 
> >> > return SEA_MOVE_COST would be better.
> >> 
> >> well, this is similar to the use of SEA_MOVE_COST but in actual fact it
> >> is completely opposite.  returning negative movecost is to signal that
> >> routes must not pass through the tile and, at the same time, provide the
> >> movecost
> >> for _ending_ the route here.
> >>
> >
> >The above should be a comment, and it is still a bad thing to return
> >-SINGLE_MOVE. Call it something like
> >
> >EVIL_TWIN_OF_SEA_MOVE_COST
> >
> >Of course, if you can think of a funnier variable name ...
> 
> 


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com


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