Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Cleaning up gotohand.c
Home

[Freeciv-Dev] Re: Cleaning up gotohand.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Cleaning up gotohand.c
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Wed, 19 Sep 2001 11:52:57 +0100 (BST)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> On Tue, Sep 18, 2001 at 10:49:39PM +0100, Gregory Berkolaiko wrote:
> > 
> > Very briefly (since I do not have the methods yet):
> > warmap_next_position(&x, &y) returns locations in order of increasing
> > distance from origin.  it's a wraper for get_from_queue actually.
> 
> I don't feel good to open such "internal" behavior/data structure. To

It is not much more open than it is now.  But far more flexible.
Example: assume for trireme warmap you only want to consider tiles next
to land.  Right now you cannot without changing generate_warmap routine
and it takes awful time already, without having to check for weird
trireme cases.

> me it looks like you have no plan what you in the surrounding
> code. What is a certain tile is better even it is more far away?

If goodness of a tile depends on it's contents in a strong way, you would
still generate the whole warmap.  But in routines like find_nearest_port,
you would stop immediately after finding the nearest port, without having
to waste CPU time.

> If I look at the structe of the SMA it is more like:
>  - generate warmap
>  - for every position reachable
>    - compute a score/fitness based in the distance and the tile at the
>      target position
>  - choose best target position

It's good if you don't generate warmaps every 10 lines of code.

But the calculation like

generate_warmap
whole_map_iterate{
  evaluate_position(x,y); /* computes fitness */
}

is ugly and unneccessary.  For an example see ai_manage_explorer.


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


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