Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2002:
[Freeciv-Dev] Re: [RFC] Path finding implementation.
Home

[Freeciv-Dev] Re: [RFC] Path finding implementation.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: Freeciv Development List <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [RFC] Path finding implementation.
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 3 Jul 2002 22:09:58 +0200

On Wed, Jul 03, 2002 at 09:34:32AM +0200, Raimar Falke wrote:
> On Tue, Jul 02, 2002 at 09:38:07PM +0100, Gregory Berkolaiko wrote:
> > Here is a summary of my position anyway:
> > 1. In TM_NONE turn and moves_left are useless.
> > 2. In TM_MIN or MAX, BMC is useless and the only combination of turns and 
> > moves_left that is good for anything is
> >     moves_spent = (turns+1)*move_rate - moves_left
> > 3. Thus we can define a universal quantity
> >     cost = (tm == TM_NONE ? BMC : (turns+1)*move_rate - moves_left)
> > which is the only sensible quantity there is.
> > 4. cost + EC is your cop
> 
> Ok if we also have the adjust_numbers callback.

I have to correct myself. This doesn't work. In the other thread
(freeciv-ai) we need a COP which only depend on EC.

> > > BTW: we should rename TC_MAXIMUM to TC_SAFE or TC_UPPER_BOUND or
> > > similar. I already have a hard time remembering what it means.
> > 
> > Whatever.  By the way, why "TC" ??
> 
> I believe it was TurnCost. TM for TurnMode and then a TM_SAFE and
> TM_LUCK?!

I have attached a new version. Changes to the interface:
 - TC_ rename
 - remove location
 - rename found_a_valid
 - rename variables to moves_left (also in the implementation)
 - add total_EC and COP
 - remove one parameter from is_dangerous_position since we don't have
 the value
 - allow NULL get_cop
 - various function rename related to pf_next
 - renamed the last position function

If you want more pf_next_get_* functions just say so. They are easy to
implement now.

Implementation:
 - *drum roll* support of is_dangerous_position *drum roll*
 - some cleanup (railroad, cmp_function,...)

About the is_dangerous_position support: you may have noticed that I
split the implementation in three parts because of this. They can be
reunited in one file but I don't think this is a good idea. The
problem is that the central structure (cell) is (very) different for
the two modes. So either a hack with a union in cell or a type safe
set of functions with different cells. The latter add some code
duplication as you see. Not nice but better than the hack which would
have resulted in the first way.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "Windows is the one true OS. MS invented the GUI. MS invented 
   the 32 bit OS. MS is open and standard. MS loves you. We have 
   always been at war with Oceana."

Attachment: path_finding12.diff.gz
Description: GNU Zip compressed data


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