[Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile ar
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9763 >
Gregory Berkolaiko wrote:
> Actually 1 is much easier to implement. Here is the algorithm (get
> get_defender before your eyes):
>
> New variable n_equal is counting the number of equally strong best units
> so far.
> 1. when change is TRUE we set n_equal = 1
> 2. when we encounter an equally strong unit,
> a) n_equal++
> b) assign the new unit as the defender with probability 1/n_equal
> c) do NOT reset n_equal
>
> this algorithm selects the defender from among the equally strong units
> with equal probability, without actually knowing, a priori, how many of
> them there will be! proof is by induction.
The algorithm is easy. The problem is the result is not reproducable.
get_defender() called on the same tile twice may not return the same
defender. This could be a problem for the AI or server code. It would
certainly be confusing for the client (mapview popup).
There are ways around this. But they're ugly.
Another problem is get_defender() may differ between server and client.
jason
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Marko Lindqvist, 2004/08/22
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Gregory Berkolaiko, 2004/08/22
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units.,
Jason Short <=
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Mike Kaufman, 2004/08/22
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Gregory Berkolaiko, 2004/08/22
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Jason Short, 2004/08/22
- [Freeciv-Dev] (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Jason Short, 2004/08/23
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Marko Lindqvist, 2004/08/23
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Marko Lindqvist, 2004/08/23
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Jason Short, 2004/08/23
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Jason Short, 2004/08/23
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Marko Lindqvist, 2004/08/23
- [Freeciv-Dev] Re: (PR#9763) Not fair: get_defender() fallbacs to tile arrival time when selecting between equal units., Marko Lindqvist, 2004/08/23
|
|