Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2003: [freeciv-ai] Re: AI Diplomacy v13 (PR#2413)

[freeciv-ai] Re: AI Diplomacy v13 (PR#2413)

[Top] [All Lists]

 To: per@xxxxxxxxxxx Subject: [freeciv-ai] Re: AI Diplomacy v13 (PR#2413) From: "Gregory Berkolaiko" Date: Mon, 4 Aug 2003 10:02:53 -0700 Reply-to: rt@xxxxxxxxxxxxxx

```On Fri, 1 Aug 2003, Per I. Mathisen wrote:

> A new version. I intend to commit this one, unless problems or objections.

Here are few last comments, after you implement/decline them, feel free to
commit:

1. aisupport.c:67, I propose this comment for the function
Calculate average distance to the target player.

For each their city we find the closest our city and average resulting
distances.

2. Same function (player_distance_to_player), the comment on line 84
appears malformatted.

4. line 668:
is obfuscating things: the previous line ensures that love gravitates
towards 0.

5. Finally, for greed function I propose the following code

#define NUM_BANDS 6

int band_incr[NUM_BANDS] = {5, 5, 10, 20, 30};
int band_rate[NUM_BANDS+1] = {10, 25, 50, 100, 250, 500};
int greed = 0;
int i = 0;
int n_love = -missing_love;

while(i < NUM_BANDS && n_love > 0) {
int band_love = MIN(band_incr[i], n_love);

greed += band_love * band_rate[i];
n_love -= band_incr[i];
i++;
}

if (n_love > 0) {
greed += n_love * band_rate[NUM_BANDS];
}

return (-greed);

#undef NUM_BANDS

G.

```