[Freeciv-Dev] Re: AI cleanup V2 (PR#1171)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Dear diary, on Sun, Dec 30, 2001 at 08:35:53AM CET, I got a letter, where
Raahul Kumar <raahul_da_man@xxxxxxxxx> told me, that...
> I've decided to respond to your comments.
>
> > > one letter variables like c with more descriptive names
> > too little of that :(
>
> Don't worry, far more of that is coming soon. It's a little bit difficult
> following the logic where the same variable name is used to mean different
> things. I've had a little bit of trouble getting my patches to work properly,
> so when I've tracked down the problem you'll see most of the one letter
> variables disappear.
I'm looking forward for that ;).
> > > finishing the change made earlier by getting rid of hardcoded nos like
> > > 6:12 with 2 * SINGLE_MOVE:4 * SINGLE_MOVE
> > Well, simple grep (ok, a little manually filtered ;) gives me:
> >
> > ./advmilitary.c: if (dist * dist < m * 3) { v *= m; v /= 3; } /* knights
> > can't attack more than twice */
>
> The above is correct, it cannot be replaced with single_move, because it
> has nothing to do with the pre-existing move costs.
True :). It was a simple grep and the manual filter is buggy ;)).
> > ./advmilitary.c: if (dist <= m * 3) urgency++;
> > ./advmilitary.c: if (dist <= m * 3) urgency++;
> > ./advmilitary.c: if (def) cur *= 3;
> > ./advmilitary.c: if (unit_type_flag(i, F_IGTER) && !def) cur *= 3;
> > ./advmilitary.c: q = (acity ? 1 : unit_types[n].move_rate *
> > (unit_type_flag(n, F_IGTER) ? 3 : 1));
>
> i'm not going to touch the igter stuff, because GB is handling that. Also,
> it is correct to multiply igter stuff by 3, because the warmap does not
> return 1/3 movement cost for igter units.
Sure, because SINGLE_MOVE is 3, as I understand it.
> > ./aiunit.c: if (unit_flag(aunit, F_IGTER)) n *= 3;
> > ./aiunit.c: if (city_got_building(pcity, B_PORT)) cur /= 3;
> > ./aiunit.c: square_iterate(punit->x, punit->y, 3, x, y) {
*plop*?
> > ./advmilitary.c: if (y >= 6 * THRESHOLD)
> > ./advmilitary.c: warmap.cost[x][y] <= (MIN(6, m) * THRESHOLD));
> > ./aiunit.c: if (warmap.seacost[x1][y1] <= 6 * THRESHOLD && t != T_OCEAN)
> > {
> > ./aiunit.c: ok += (6 * THRESHOLD - warmap.seacost[x1][y1]);
> > ./aiunit.c: maxd = MIN(6, m) * THRESHOLD + 1;
> > ./aiunit.c: warmap.seacost[acity->x][acity->y] <= 6 *
> > THRESHOLD))) ||
> > ./aiunit.c: int best = 6 * THRESHOLD + 1, cur;
> > ./aiunit.c: if (best > 6 * THRESHOLD) return 0;
>
> I thought you were handling the threshold stuff. If you'd like me to send in
> patches about threshold I will.
Ah-ha ;). Well, I will have a look at it as I will have some time.
> > ./advmilitary.c: else pcity->ai.wallvalue = (danger * 9 - badmojo * 8) * 10
> > / (danger);
>
> No idea what wallvalue, 9, 8 and 10 mean, so nothing for the moment.
It's 100% nothing with SINGLE_MOVE ;).
> > ./advmilitary.c: !unit_type_flag(i, F_IGWALL) &&
> > !city_got_citywalls(acity)) d *= 9;
>
> I think I know what that is about. The defensive bonus of a city wall is
> 3, but since the defensive power stuff divides by 15, it is probably necessary
> to use 9 here.
Ok. Looks like that.
--
Petr "Pasky" Baudis
UN*X programmer, UN*X administrator, hobbies = IPv6, IRC, FreeCiv, (e)links
.
Firewall in a way is like the doorkeeper of a local pub. If you don't have your
I.D. on you, or if for some reason you do not qualify to enter, the doorkeeper
will not permit you to enter. In some extreme cases these doorkeepers will not
let you out, or at least give you a hard time before they finally let you out.
.
Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/
|
|