Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: [RFC] Move cost map interface
Home

[Freeciv-Dev] Re: [RFC] Move cost map interface

[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: [RFC] Move cost map interface
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Fri, 26 Apr 2002 16:39:13 +0100 (BST)

I suspect you are trying to compare moves_expended calculated in AVERAGE 
mode and turns calculated in MAXIMAL mode.  They are obviously not the 
same.

Please complain if I'm confusing you.

I also suspect that by "stimulate" you mean "simulate".

G.

On Thu, 25 Apr 2002, Raimar Falke wrote:

> On Thu, Apr 25, 2002 at 06:10:51PM +0100, Gregory Berkolaiko wrote:
> > I have no major complaints.  However I expect big arguments when it comes 
> > to implementation.  Also, I don't think I can spend much time on it until 
> > late May.
> 
> I played a little with my current implementation and
> 
> > On Wed, 24 Apr 2002, Raimar Falke wrote:
> > 
> > > On Tue, Apr 16, 2002 at 09:57:39AM +0200, Raimar Falke wrote:
> > > > Attached a version which have the requested changes. You would want to
> > > > wrap an int in the void *.
> > > 
> > > And now version 8. Changes:
> > >  - added move_backward flag
> > 
> > right.
> > I still think that it's better to have one map_type enum instead of three
> > different flags, but it's not important.
> 
> > >  - added move_expended array
> > 
> > The information given by 
> >     moves_expended, initial_moves
> > and by 
> >     turn, move_left
> > is equivalent.
> 
> I currently think that this is wrong. I get (where "cost" is the total
> sum of all BMC i.e. move_expended). "turns" is the number of turns we
> need to reach the given pos and "moves_left" the moves left at the
> final position.
> 
> 2: stimulate_pf: MARK: (39, 39) cost=0, turns=0, moves_left=6
> 
> So we start with at (39,39) with 6 moves left. And then iterate
> yielding:
> 
> 2: stimulate_pf: MARK: (38, 40) cost=3, turns=0, moves_left=3
> 2: stimulate_pf: MARK: (40, 39) cost=3, turns=0, moves_left=3
> 2: stimulate_pf: MARK: (38, 39) cost=3, turns=0, moves_left=3
> 2: stimulate_pf: MARK: (40, 38) cost=3, turns=0, moves_left=3
> 2: stimulate_pf: MARK: (39, 38) cost=3, turns=0, moves_left=3
> 2: stimulate_pf: MARK: (38, 37) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (40, 37) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (39, 37) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (41, 40) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (41, 39) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (39, 41) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (38, 41) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (37, 41) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (37, 40) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (37, 39) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (40, 40) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (39, 40) cost=6, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (38, 38) cost=9, turns=0, moves_left=0
> 2: stimulate_pf: MARK: (36, 41) cost=7, turns=1, moves_left=5
> 2: stimulate_pf: MARK: (38, 36) cost=7, turns=1, moves_left=5
> 2: stimulate_pf: MARK: (37, 42) cost=7, turns=1, moves_left=5
> 2: stimulate_pf: MARK: (38, 35) cost=8, turns=1, moves_left=4
> 2: stimulate_pf: MARK: (36, 40) cost=8, turns=1, moves_left=4
> 2: stimulate_pf: MARK: (38, 34) cost=9, turns=1, moves_left=3
> 
> 2: stimulate_pf: MARK: (36, 38) cost=9, turns=1, moves_left=3
> 
> Detail on this "normal" path which costs 9:
> 
> 2: PF:  consists of 4 positions:
> 2: PF:    0/4: (39,39) (t=0,p=6) dir=SW
> 2: PF:    1/4: (38,40) (t=0,p=3) dir=NW
> 2: PF:    2/4: (37,39) (t=0,p=0) dir=NW
> 2: PF:    3/4: (36,38) (t=1,p=3) dir=[Bad Direction]
> 
> 2: stimulate_pf: MARK: (36, 39) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (36, 42) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (41, 41) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (41, 36) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (40, 36) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (39, 36) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (37, 36) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (35, 40) cost=9, turns=1, moves_left=3
> 2: stimulate_pf: MARK: (36, 43) cost=10, turns=1, moves_left=2
> 2: stimulate_pf: MARK: (39, 35) cost=10, turns=1, moves_left=2
> 2: stimulate_pf: MARK: (37, 35) cost=10, turns=1, moves_left=2
> 2: stimulate_pf: MARK: (35, 42) cost=10, turns=1, moves_left=2
> 2: stimulate_pf: MARK: (35, 41) cost=10, turns=1, moves_left=2
> 2: stimulate_pf: MARK: (39, 34) cost=10, turns=1, moves_left=2
> 2: stimulate_pf: MARK: (35, 39) cost=10, turns=1, moves_left=2
> 2: stimulate_pf: MARK: (37, 34) cost=11, turns=1, moves_left=1
> 2: stimulate_pf: MARK: (39, 33) cost=11, turns=1, moves_left=1
> 2: stimulate_pf: MARK: (40, 34) cost=11, turns=1, moves_left=1
> 2: stimulate_pf: MARK: (39, 32) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (34, 41) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (34, 40) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (34, 39) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (36, 36) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (36, 35) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (42, 36) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (42, 35) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (41, 35) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (40, 35) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (35, 43) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (35, 38) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (36, 37) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (35, 37) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (38, 33) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (40, 41) cost=12, turns=1, moves_left=0
> 2: stimulate_pf: MARK: (37, 37) cost=12, turns=1, moves_left=0
> 
> 2: stimulate_pf: MARK: (37, 38) cost=9, turns=1, moves_left=0
> 
> This one is odd. Lets look at the details:
> 
> 2: PF:  consists of 3 positions:
> 2: PF:    0/3: (39,39) (t=0,p=6) dir=W
> 2: PF:    1/3: (38,39) (t=0,p=3) dir=NW
> 2: PF:    2/3: (37,38) (t=1,p=0) dir=[Bad Direction]
> 
> The first step (((39,39) -> (38,39)) costs 3 and the second ((38,39)
> -> (37,38)) costs 6 points. So the unit has to wait at (38,39) to
> recharge the points and after the step it has 0 points.
> 
> So either I'm completely wrong or you can't extract the turns and
> moves_left info from the cost field.
> 
> 2: stimulate_pf: MARK: (35, 44) cost=13, turns=2, moves_left=5
> 2: stimulate_pf: MARK: (34, 36) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (34, 37) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (35, 36) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (35, 35) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (33, 39) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (33, 42) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (33, 41) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (33, 40) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (40, 31) cost=15, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (41, 34) cost=14, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (41, 33) cost=14, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (40, 32) cost=14, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (40, 33) cost=13, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (34, 43) cost=13, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (34, 42) cost=13, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (36, 44) cost=13, turns=2, moves_left=3
> 2: stimulate_pf: MARK: (32, 40) cost=16, turns=2, moves_left=2
> 2: stimulate_pf: MARK: (41, 32) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (41, 31) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (41, 30) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (32, 39) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (32, 38) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (33, 37) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (33, 36) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (33, 38) cost=18, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (34, 38) cost=16, turns=2, moves_left=0
> 2: stimulate_pf: MARK: (32, 36) cost=21, turns=3, moves_left=3
> 2: stimulate_pf: MARK: (32, 37) cost=21, turns=3, moves_left=3
> 2: stimulate_pf: MARK: (31, 37) cost=21, turns=3, moves_left=3
> 2: stimulate_pf: MARK: (31, 38) cost=21, turns=3, moves_left=3
> 2: stimulate_pf: MARK: (42, 30) cost=21, turns=3, moves_left=3
> 2: stimulate_pf: MARK: (42, 31) cost=21, turns=3, moves_left=3
> 2: stimulate_pf: MARK: (31, 39) cost=19, turns=3, moves_left=3
> 2: stimulate_pf: MARK: (31, 36) cost=24, turns=3, moves_left=0
> 2: stimulate_pf: MARK: (40, 30) cost=21, turns=3, moves_left=0
> 
> > So I think it is excessive to have both of them.
> > If I were you, I would convert moves_left to an array though (however it 
> > only makes sense for MINIMAL and MAXIMAL modes).
> 
>       Raimar
> 
> 



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