Re: (PR#9610) AI movemap

"Per I. Mathisen" <per-0/[email protected]> Sun, 21 Nov 2004 05:33:17 -0800
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9610 >

On Sat, 20 Nov 2004, Benedict Adamson wrote:
> The movemap stores for each tile a struct holding two unit lists:
> one_turn and two_turn. There is therefore repeated code, where an
> operation is performed on the one_turn list and then on the two_turn
> list. In the bodyguard code I'm writing, this repetition is particularly
> ugly.
>
> I think it would be better to store a fixed-length array of lists, with
> the length #define-d as 2, and using loops over the array of lists
> instead of duplicating code. This would give the further benefit of
> making it a trivial change to increase the look-ahead above 2 turns.

This is not a bad idea.

However, once we go beyond 2 or 3 turns, we need to change the algorithm
to be faster and less accurate. For the danger code, I see a limitation in
the present movemap code here, because early game we need to see several
turns into the future to be able to build a sufficient defence, and it is
also worthwhile because enemies take long to arrive.

  - Per