Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] Re: (PR#12734) A new, fast and greedy CM implementation
Home

[Freeciv-Dev] Re: (PR#12734) A new, fast and greedy CM implementation

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12734) A new, fast and greedy CM implementation
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Wed, 6 Apr 2005 16:18:54 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12734 >

On Wed, 6 Apr 2005, Per I. Mathisen wrote:

>
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12734 >
>
> I was tired of slow AI games, so I decided to handle the root of all evil
> - the city management code. I wrote my own CM from scratch, and stuffed it
> in the bottom of city.c. At approx 300 lines of code, it is not very big.
>
> In a very difficult, very large savegame that I used for reference, CM did
> 26% better in finding optimal solutions according to the scoring test I
> made. The greedy function was, however, 154 times faster.
>
> Yes, you read that right. It really is blazing fast. Playing on huge maps
> with lots and lots of cities under AI control is a rather different
> experience with this patch.
>
> If you want to measure for yourself, change "#if 0" to "#if 1" in
> server/cityturn.c; if you want more comments on the design, see the huge
> function header comment on the greedy function itself.

Nitpicking:

instead of:
+  if (t1 == NULL) {

use:

+  if (!t1) {

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa







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