Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: new patch: autoattack
Home

[Freeciv-Dev] Re: new patch: autoattack

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: new patch: autoattack
From: Jason Dorje Short <vze49r5w@xxxxxxxxxxx>
Date: Fri, 22 Nov 2002 22:08:49 -0500
Reply-to: jdorje@xxxxxxxxxxxxxxxxxxxxx

Per I. Mathisen wrote:

+        if (punitwin == 0) {
+          /* No threat, don't waste. */
+          continue;
+        }
+
+        if (punitwin < penemywin) {
+          /* Yep, that's all there is to it! */
+ (void) handle_unit_move_request(penemy, punit->x, + punit->y, FALSE, FALSE);
+        }

We want to attack if our chance of winning is better if we attack than if they do.

  our chance of winning if we attack = penemywin (we're the "enemy")
  our chance of winning if they attack = 1 - punitwin

So the second check should be

  if (penemywin > 1.0 - punitwin) {
    /* ...autoattack ... */
  }

which makes the first check redundant and unnecessary (and bad in the case below).

This will not get us to attack diplomats or other near-helpless units that we may want to attack. So perhaps

  if (penemywin > 1.0 - punitwin || penemywin > 0.99) {
    /* ...autoattack... */
  }

or something along those lines. Alternately we could try to assess the danger of a diplomat/spy in a non-military way.

jason



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