Complete.Org: Mailing Lists: Archives: freeciv: August 2005:
[Freeciv] Re: siege
Home

[Freeciv] Re: siege

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv@xxxxxxxxxxx
Subject: [Freeciv] Re: siege
From: Sam Steingold <sds@xxxxxxx>
Date: Fri, 12 Aug 2005 12:58:54 -0400
Reply-to: sds@xxxxxxx

> * Jonadab the Unsightly One <wbanqno-IrLFYxOktEFfGaWA9+OTKt@xxxxxxxxxxxxxxxx> 
> [2005-08-12 11:03:09 -0400]:
>
> Sam Steingold <sds@xxxxxxx> writes:
>
>> >> tile availability is defined as follows:
>> >
>> > [by an O(n^2) algorithm if I understand it correctly, where n is the
>> > number of units that can reach any of the city's tiles in one turn,
>> > which with railroads could easily be dozens of units, potentially
>> > thousands on a large map]
>> >
>> > That might have an adverse impact on performance, since it has to be
>> > calculated each turn for each city.
>> 
>> why is it quadratic?
>> we apply units one by one.
>
> For each square being considered, each friendly unit that can reach
> the square must be compared to each enemy unit that can reach the
> square.

not really - the best offensive enemy unit has to be compares to the
best defensive and the best offensive friendly unit.
this is O(n log n)

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.jihadwatch.org/> <http://ffii.org/> <http://www.mideasttruth.com/>
<http://www.savegushkatif.org> <http://www.openvotingconsortium.org/>
If at first you don't suck seed, try and suck another seed.




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