Follow-up Comment #9, patch #1432 (project wesnoth):

>I can think of three reasons. 1. "(...):play_turn()" is damn ugly. 2. It
removes about 20 lines of C++ code. 3. It avoids an indirection.

Ok, I'll add 'method=' support (while still keeping code= , as it can be
useful, e.g. for self-contained macroses)


>By the way, I still don't understand why you require the user to pass the
side parameter back to the Lua AI interface functions. There is only one sane
value, which is the current playing side.
We'll need to somehow pass that 'current playing side' to the functions which
do moves/attacks/etc, as we cannot get this info from 'whose turn is it?',
because of:
1) chat messages can be sent/received during turns of other sides.
2) evaluations can be done during turns of other sides. e.g.. things like "AI
for side 7, please show me your current evaluation of the battlefield" or "AI
for side 3, please add a new goal to yourself" should be possible. And,
later, we might need to allow inter-ai communication between AIs of several
allied sides.

Note that the AI developer does not have to deal with that - his interface is
clean from that ugly stuff.

>First, wesnoth.require should be used instead of dofile, so that all the AI
instances of the same engine share the same code. Second, the file should
only define a function, rather than directly return an AI, and this function
should then be called, possibly by passing side as an argument. 
 ok, I'll think about it more and try it out. Note that there's only 1 AI
instance of the same engine, because engine is a 'stateful component in
context of the AI'

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1432>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to