[Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification (rev
[Top] [All Lists]
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
| 
Subject:  | 
[Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification (rev.) | 
 
| 
From:  | 
"Brian Dunstan" <bdunstan149@xxxxxxxxx> | 
 
| 
Date:  | 
Tue, 19 Apr 2005 15:50:22 -0700 | 
 
| 
Reply-to:  | 
bugs@xxxxxxxxxxx | 
 
 
 
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12833 >
--- Peter Schaefer <peter.schaefer@xxxxxxxxx> wrote:
> 
> <URL:
> http://bugs.freeciv.org/Ticket/Display.html?id=12833
> >
> 
> Well I trust you will tell me when I get on your
> nerves:
> 
>  I looked at the source and it seems to me it 
> 1)iterates over all cities, all tiles, and there is
> no break or return
> to return early
> 2)higher value of newtiles is good
> If I go wrong in the above, I'm probably wrong in my
> ideas below.
> 
> Now, thinking aloud, if one had cache of     
> >int diff = new_tile_value - old_tile_value; 
> such that one could determine max over all tiles/all
> tiles within my
> borders on this continent of(diff), or if one would
I think this is a good idea. 
(new_tile_value-old_tile_value) does not depend on the
unit performing the activity, so it could be stored
with the city.  I think with that, and adding an
iterator over all the activities, we could get away
drastically reducing the size of
evaluate_improvements(), and doing away with
consider_settler_action() completely.
With a simpler setup, it might be easier to implement
a solution for the pollution cleanup problems, etc.
evaluate_improvements() (oversimplified) could look
like this: 
(attached)
                
__________________________________ 
Do you Yahoo!? 
Plan great trips with Yahoo! Travel: Now over 17,000 guides!
http://travel.yahoo.com/p-travelguide
evaluate_improvements(punit, best_act, best_tile) {
  city_list_iterate(pplayer, pcity) {
    city_map_iterate(pcity, ptile) {
      
      unit_activity_iterate(punit, activity) {
        if(we_can_do_this_activity()) {
          
          time = mv_turns + get_turns_for_activity();
          total_value = amortize(pcity->ai.value[activity], time);
          if(total_value > best_value) {
            best_value = total_value; 
            /* select this activity */
          }
        }
      } unit_activity_iterate_end;
    } city_map_iterate_end;
  } city_list_iterate_end;
}
 
- [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification (rev.), Brian Dunstan, 2005/04/19
- [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification (rev.), Peter Schaefer, 2005/04/19
- [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification (rev.), Brian Dunstan, 2005/04/19
- [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification (rev.), Brian Dunstan, 2005/04/19
 - [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification (rev.),
Brian Dunstan <=
 - [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification, (Eddie Anderson), 2005/04/20
 - [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification, Brian Dunstan, 2005/04/20
 - [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification, Peter Schaefer, 2005/04/20
 - [Freeciv-Dev] Re: (PR#12833) consider_settler_action simplification, Brian Dunstan, 2005/04/20
 - [Freeciv-Dev] (PR#12833) Re: (PR#12844) Re: consider_settler_action simplification, (Eddie Anderson), 2005/04/29
 - [Freeciv-Dev] Re: (PR#12833) Re: (PR#12844) Re: consider_settler_action simplification, Peter Schaefer, 2005/04/29
 
  
  
  
 
 
 | 
 |