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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [freeciv-ai] Re: AI Diplomacy v11 (PR#2413)
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sun, 20 Jul 2003 10:19:16 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, 2 Jul 2003, Per I. Mathisen wrote:

> 
> CHANGES:
>   - fixed bug where we thought no-contact meant active warfare, reported
> by both Jordi and David M Stewart.
>   - updated to current cvs
> 
> This only changes the patch against the cvs files. The extra files that
> need to be added can be found in the v10 post.

Here are some comments to the code (note that I haven't tried compiling 
it, but spent about 1,5 hours reading the code):

1. Comment to aisupport_distance_to_player.

2. Make greed() like progressive taxation.

3. In ai_goldequiv_clause, if we are given a tech we know, but one of our
allies doesn't, we think it's worth something.

4. Same, why can we not make peace with someone who is allied with our
enemy?  It's good for us, and bad for our enemy (he will get annoyed and
break the alliance).

5. Same,
        worth = greed(adip->love - (ai->diplomacy.love_incr
                                    + ai->diplomacy.love_coeff));
then, 5 lines below
        worth = greed(adip->love - (ai->diplomacy.love_incr
                                    * ai->diplomacy.love_coeff));
(a) note the disparity in the arthmetic
(b) why bother with love_incr/coeff ?  Be simpler!

6. ai_treaty_accepted, need a better header comment (what does the
function do?).  Also, it's good to define "gift", it took m a while to
figure out that it's a treaty with _every_ clause favourable to us.  
Also, even if it's not a gift, just a favourable (overall) treaty, we can
increase love by a smaller amount?

7. In AI diplomacy calculate,
    adip->love -= (adip->love * ai->diplomacy.love_coeff / 100);
    if (adip->love > 0) {
      adip->love--;
    } else if (adip->love < 0) {
      adip->love++;
    }
The "if" is excessive.  Keep it simple.

8. Does AI ever break an alliance, or only if it loses patience?  But AIs
are true to their ally obligations, so this no threat to patience.  Need
some strategic thinking, if the alliance is still needed.

9. In ai_go_to_war,
  ai->diplomacy.timer = myrand(4) + 3;
  if (adip->love < 0) {
    ai->diplomacy.timer += adip->love / 10;
  } else {
This will reduce the timer.  I think you got the sign wrong.

10. In ai_diplomacy_actions
    /* Spam control */
    adip->spam = MAX(adip->spam - 1, 0);
....
    if (adip->spam > 0) {
      /* Don't spam */
      continue;
    }
The MAX is not needed.  Also, move adip->spam--; closer to the "if",
for better readability.

11. Same,
      notify(aplayer, _(TALK(%s) "Greetings friend, may we suggest "
             "a joint campaign against %s?"), pplayer->name, 
target->name);
The same message is sent when talking about alliance and peace.  I think 
it should be something different for peace.

12. Assumption that we should wage war at least on one other civ is
inherent in the code.  In the future it should change IMO.  If the civ has
decent (or the best) research rate, it should consider getting a tech
advantage first.





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