Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: stop ai from building useless buildings (2) (PR#1362)
Home

[Freeciv-Dev] Re: stop ai from building useless buildings (2) (PR#1362)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: stop ai from building useless buildings (2) (PR#1362)
From: Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 5 Apr 2002 22:20:38 -0800 (PST)

Per I. Mathisen wrote:
Changes from last patch:
 -> some formatting fixes & more meaningful variable names
 -> capital considered as a special case
 -> SAM restricted to coastline of safe continents

I have also introduced a new handicap, H_EXPERIMENTAL, and a new
difficulty level, 'experimental'. This is for testing of new AI changes.
'experimental' is just like 'hard' but with H_EXPERIMENTAL set.

So, to test new AI code, do like this:

        if (ai_handicap(pplayer, H_EXPERIMENTAL) {
          /* experimental code */
        } else {
          /* old code */
        }

Run a few dozen autogames to see if things improve or not. And then remove
old code and handicap check before submitting.

I like the idea behind this (a lot), but I think you're going about it slightly wrong. I have always considered the handicap list as something not directly related to the AI, but that could be related to any player. So it should eventually be possible to give human players these handicaps (except they're really unhandicaps). Not all of the handicaps fit this description, but most of them do.

I think it would be *easier* to accomplish what you're trying to do by using different difficulty levels. For instance, with something like:

  if (ai_difficulty(pplayer) >= 8) {
    /* experimental code */
  } else {
    /* old code */
  }

you can then face off a difficulty-7 (hard) AI player against a difficulty-10 player. (Note, there is no ai_difficulty(), it's something like pplayer->ai.skill_level instead.)

This doesn't work so well if all the difficulty levels are eventually used. But I still feel having "experimental" be listed under the handicaps is somehow wrong...

Of course, if you're just using this patch locally you can do whatever you want. But I think you should consider what the "handicaps" should be before pushing for inclusion of such a patch.

Here are my results from autogame pitfights:
        experimental vs hard:    52:39

Not very meaningful, but:
        hard vs easy:            25:1
        experimental vs easy:    38:0

I think that is a nice improvement. I also think it is ready to go into
cvs now.

Wow, that's nice.  This information is very good to see :-).

jason




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