[freeciv-ai] (PR#10110) AI underestimates Temples
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[freeciv-ai] (PR#10110) AI underestimates Temples |
From: |
"Mateusz Stefek" <mstefek@xxxxxxxxx> |
Date: |
Thu, 16 Sep 2004 06:25:02 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10110 >
> [per - Thu Sep 16 12:30:40 2004]:
>
> On Thu, 16 Sep 2004, Mateusz Stefek wrote:
> > This evaluation seems to work correctly:
> > case EFT_MAKE_CONTENT:
> > if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
> > int a = MIN(pcity->ppl_unhappy[4] +
> > pcity->specialists[SP_ELVIS], amount);
> > v += a * a * 2;
> > v += amount * c;
> > }
>
> Thanks, will look at it.
Hmm, it doesn't work (I was testing it on a very advanced game)
Here's my patch. I think now AI plays much better.
Main problem is that values measured in percentages are treated in the
same way as those mesured in pieces.
for example old code for coastal defence:
v += 8 * amount;
and for temple:
v += pcity->ppl_unhappy[0] * amount;
v += amount * c;
My patch also fixes a bug in aqueduct evaluation
> > Another problem is that AI doesn't reassign workers when it finish
> > building an improvement (This is a serious bug).
>
> When? If you mean in want calculations, then yes, this is a limitation.
> Running CM to rearrange workers just takes too long. This is what I did in
> my first AI effects code, and there just was no way to speed it up
> properly.
When AI build temple or colloseum it doesn't rearange workers in next
turns, so the effect of the building isn't applied.
--
mateusz
Index: aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.163
diff -u -r1.163 aicity.c
--- aicity.c 13 Sep 2004 15:54:49 -0000 1.163
+++ aicity.c 16 Sep 2004 13:18:05 -0000
@@ -257,18 +257,19 @@
/* WAG evaluated effects */
case EFT_NO_UNHAPPY:
- v += (pcity->specialists[SP_ELVIS] + pcity->ppl_unhappy[0]) * 3;
+ v += (pcity->specialists[SP_ELVIS] + pcity->ppl_unhappy[0]) * 20;
+ v += 50;
break;
case EFT_FORCE_CONTENT:
if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
- v += (pcity->ppl_unhappy[0] + pcity->specialists[SP_ELVIS]) * 3;
+ v += (pcity->ppl_unhappy[4] + pcity->specialists[SP_ELVIS]) * 20;
v += 5 * c;
}
break;
case EFT_MAKE_CONTENT:
if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
- v += pcity->ppl_unhappy[0] * amount;
- v += amount * c;
+ v += MIN(pcity->ppl_unhappy[4] + pcity->specialists[SP_ELVIS],
amount) * 20;
+ v += MIN(amount, 5) * c;
}
break;
case EFT_MAKE_CONTENT_MIL:
@@ -284,7 +285,8 @@
* (nplayers - amount)) / (nplayers * amount * 100);
break;
case EFT_GROWTH_FOOD:
- v += c * 4 + 25;
+ /* Temple should be more worth than granary (In default rules)*/
+ v += c * (amount / 3);
break;
case EFT_AIRLIFT:
v += c + ai->stats.units[UCL_LAND];
@@ -333,10 +335,13 @@
amount = 20; /* really big city */
/* there not being a break here is deliberate, mind you */
case EFT_SIZE_ADJ:
- if (city_can_grow_to(pcity, pcity->size + 1)) {
- v += pcity->food_surplus * ai->food_priority * amount / 10;
+ if (!city_can_grow_to(pcity, pcity->size + 1)) {
+ v += pcity->food_surplus * ai->food_priority * amount;
+ if (pcity->size == game.aqueduct_size) {
+ v += 30 * pcity->food_surplus;
+ }
}
- v += c * amount / game.aqueduct_size;
+ v += c * amount * 4 / game.aqueduct_size;
break;
case EFT_SS_STRUCTURAL:
case EFT_SS_COMPONENT:
@@ -387,23 +392,24 @@
break;
case EFT_SEA_DEFEND:
if (ai_handicap(pplayer, H_DEFENSIVE)) {
- v += amount * 10; /* make AI slow */
+ v += amount; /* make AI slow */
}
if (is_ocean(map_get_terrain(pcity->x, pcity->y))) {
v += ai->threats.ocean[-map_get_continent(pcity->x, pcity->y)]
- ? amount * 8 : amount;
+ ? amount/5 : amount/20;
} else {
adjc_iterate(pcity->x, pcity->y, x2, y2) {
if (is_ocean(map_get_terrain(x2, y2))) {
if (ai->threats.ocean[-map_get_continent(x2, y2)]) {
- v += 8 * amount;
+ v += amount/5;
+ break;
}
}
} adjc_iterate_end;
}
v += (amount + ai->threats.invasions - 1) * c; /* for wonder */
if (capital && ai->threats.invasions) {
- v += amount * 10; /* defend capital! */
+ v += amount; /* defend capital! */
}
break;
case EFT_AIR_DEFEND:
@@ -411,12 +417,12 @@
v += amount * 15; /* make AI slow */
}
v += (ai->threats.air && ai->threats.continent[ptile->continent])
- ? amount * 5 + amount * c : c;
+ ? amount/10 * 5 + amount/10 * c : c;
break;
case EFT_MISSILE_DEFEND:
if (ai->threats.missile
&& (ai->threats.continent[ptile->continent] || capital)) {
- v += amount * 5 + (amount - 1) * c;
+ v += amount/10 * 5 + (amount/10 - 1) * c;
}
break;
case EFT_LAND_DEFEND:
@@ -427,7 +433,7 @@
|| capital
|| (ai->threats.invasions
&& is_water_adjacent_to_tile(pcity->x, pcity->y))) {
- v += !ai->threats.igwall ? 15 + (capital * amount * 5) : 10;
+ v += !ai->threats.igwall ? 15 + (capital * amount / 10) : 10;
}
v += (1 + ai->threats.invasions + !ai->threats.igwall) * c;
break;
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, (continued)
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Marko Lindqvist, 2004/09/15
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Jason Short, 2004/09/15
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Per I. Mathisen, 2004/09/15
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Per I. Mathisen, 2004/09/15
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Jason Short, 2004/09/15
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Jason Short, 2004/09/15
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Marko Lindqvist, 2004/09/15
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Vasco Alexandre da Silva Costa, 2004/09/15
- [freeciv-ai] (PR#10110) AI underestimates Temples, Mateusz Stefek, 2004/09/16
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Per I. Mathisen, 2004/09/16
- [freeciv-ai] (PR#10110) AI underestimates Temples,
Mateusz Stefek <=
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Per I. Mathisen, 2004/09/16
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Mateusz Stefek, 2004/09/16
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Benoit Hudson, 2004/09/16
- [freeciv-ai] Re: (PR#10110) AI underestimates Temples, Vasco Alexandre da Silva Costa, 2004/09/16
|
|