Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] Re: using OR in requirements
Home

[Freeciv-Dev] Re: using OR in requirements

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: using OR in requirements
From: Per Inge Mathisen <per@xxxxxxxxxxx>
Date: Fri, 2 Dec 2005 18:44:56 +0000 (GMT)

On Fri, 2 Dec 2005, Jason Dorje Short wrote:
> We discussed having OR before, and decided it wasn't a good idea because
> of added complexity.

And I agree with that.

> If it were only done for effects and then things were split during
> ruleset loading, that might be feasible.The problem is that reqs are used
> in lots of places and have a consistent format; how will you add
> extensions without breaking that format?

One idea is to rename "reqs" to "all_of_req" and "nreqs" to "none_of_req",
for all requirements, and add "one_of_req" as an additional possibility
existing only for effects, like this:

[effect_martial_law_each_0]
name    = "Martial_Law_Each"
value   = 1
one_of_req  =
    { "type",       "name",      "range"
      "Gov", "Anarchy",   "Player"
      "Gov", "Despotism", "Player"
      "Gov", "Monarchy",  "Player"
    }
all_of_req =
    { "type",       "name",      "range"
      "Tech", "Monarchy",  "Player"
    }
none_of_req =
    { "type",       "name",      "range"
      "Tech", "Nationalism",  "Player"
    }

At least such a renaming would dispell any questions as to whether
requirements are AND or OR. But it is more ugly, I think.

Easier then to just add "one_of_req" as a special case for effects, like
this:

[effect_martial_law_each_0]
name    = "Martial_Law_Each"
value   = 1
one_of_req  =
    { "type",       "name",      "range"
      "Gov", "Anarchy",   "Player"
      "Gov", "Despotism", "Player"
      "Gov", "Monarchy",  "Player"
    }
reqs =
    { "type",       "name",      "range"
      "Tech", "Monarchy",  "Player"
    }
nreqs =
    { "type",       "name",      "range"
      "Tech", "Nationalism",  "Player"
    }

I am not sure which is better. Perhaps there are other, better solutions.
However, some kind of OR solution is greatly desired for advanced
governments effects, of which there will be a great many to be defined the
way I have drafted the design currently.

  - Per




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