mattsc
faeaf5e47c
ai_helper.get_attacks: improve check for units in the way
...
Check whether the unit in the way has an unoccupied hex to move to.
Previously, it was only checked whether its reach was >1, which
sometimes can include only hexes occupied by units on its own side,
making the actual move impossible.
2014-06-15 14:22:18 -07:00
mattsc
03c1b97802
next_hop(): bug fix for ignoring units when ignore_units=true is set
...
A bug in the previous version let to them not being ignored when the
were on the last hex of the next hop.
2014-05-02 19:29:37 -07:00
mattsc
f0c7ddcab1
ai_helper: make AI move error messages more descriptive
2014-04-30 18:59:25 -07:00
mattsc
bbffa5e88a
ai_helper: remove a debug message
...
It’s served its purpose and is not needed any more.
2014-04-26 18:26:45 -07:00
mattsc
e99423bad9
Lua AIs: do not use empty tables as filters
...
It’s faster not to provide any argument to wesnoth.get_units() if all
units are to be found.
2014-04-26 07:18:23 -07:00
mattsc
8e9780d606
ai_helper.get_live_units: don't use filter_wml
...
It’s slow, the new method is between 10 and 20 times faster.
2014-04-26 06:46:32 -07:00
mattsc
9701a724a8
ai_helper.lua: avoid using table.remove
...
It’s slow. The inverse logic using table.insert is much faster,
especially for large tables.
2014-04-17 21:03:38 -07:00
mattsc
19eff08fd7
Fix a typo
2014-04-17 21:03:38 -07:00
mattsc
f6cdd85182
AI helper functions: code cleanup, first pass
...
These function libraries are still work in progress and change
frequently, so the code cleanup is mostly just to make sure the syntax
is consistent with that used in the Micro AIs. Changes or improvements
to the algorithms might be made at a later time.
2014-04-17 21:03:38 -07:00
mattsc
98509aa2bf
Fix a typo
...
I had actually introduced this typo intentionally for testing purposes
and then forgotten to remove it. :-P
2014-04-10 10:39:12 -07:00
mattsc
c4cb6168e4
Micro AIs: avoid using formula= in SUFs
...
It’s slow for finding units with moves or attacks left. The
alternative method of getting all units and then looping over the table
with a condition is much faster.
2014-04-10 10:06:25 -07:00
mattsc
9e6b780306
ai_helper.get_closest_location(): fix bug with tags in SLF
...
The way how the Standard Location Filter was dealt with only worked
with keys, not tags.
2014-03-26 18:03:50 -07:00
mattsc
b7bc394f95
Micro AIs: improve error reporting
...
Use error() instead of wesnoth.message(), as this also produces a stack
traceback.
2014-02-27 17:06:20 -08:00
mattsc
d3e9cb3957
Micro AIs: add check for valid recruiting and error message
...
This now checks whether the recruiting intended to be done with
ai.recruit is possible and displays an error message if it is not.
2014-02-27 17:06:19 -08:00
mattsc
835194eee4
Micro AIs: add check for valid stopunit execution and error message
...
This now checks whether the stopunit execution intended to be done with
ai.stopunit_all, ai.stopunit_attacks or ai.stopunit_moves is possible
and displays an error message if it is not.
2014-02-27 17:06:19 -08:00
mattsc
f0506b2d31
Micro AIs: add check for valid move and error message
...
This now checks whether the move intended to be done with ai.move is
possible and display an error message if it is not.
2014-02-27 17:06:19 -08:00
mattsc
c06529aa18
Micro AIs: add check for valid full move and error message
...
This now checks whether the move intended to be done with ai.move_full
is possible and display an error message if it is not.
2014-02-27 17:06:19 -08:00
mattsc
70e3fc58bd
Micro AIs: add check for valid attacks and error message
...
This will now check whether the attack intended to be done with
ai.attack is possible and display an error message if it is not.
2014-02-27 17:06:18 -08:00
mattsc
e78462c395
Remove function ai_helper.random()
...
This was using the synced RNG which is exactly the wrong thing to do
within the AI evaluation/execution functions.
2014-02-20 11:33:05 -08:00
mattsc
21c8c5c860
ai_helper: add functions to get direction indices and strings
...
These consist of a number of supplementary functions, plus three
function get_cardinal_directions, get_intercardinal_directions and
get_hex_facing which return strings for the directions (in cartesian or
hex coordinates) between two hexes.
2013-12-02 11:01:44 -08:00
mattsc
623036af16
ai_helper.put_labels: display content of strings rather than 'nan'
2013-12-02 10:58:49 -08:00
mattsc
71f92aa05c
ai_helper.get_dst_src(units): minor code simplification
2013-11-14 20:04:53 -08:00
mattsc
5f39a7d2dc
ai_helper.get_enemy_dst_src: add optional parameter 'enemies'
...
If 'enemies' table is given, use it, otherwise use all enemy units.
2013-11-14 20:04:53 -08:00
mattsc
24f10a37ef
ai_helper: improve criterion for impassable terrain
...
Rather than checking whether the movement cost is <99, check whether it
is <= max_moves for the unit.
2013-11-14 20:04:52 -08:00
mattsc
e18378369b
ai_helper: remove unused function ai_helper.got_1_11()
2013-10-30 13:02:09 -07:00
mattsc
659162371b
Internal rewrite of ai_helper.get_attacks()
...
This is much faster than the previous version. No change in
functionality.
2013-09-04 20:20:25 -07:00
mattsc
0891bffafb
ai_helper.put_labels(): add optional keys= parameter
2013-07-16 08:32:45 -07:00
mattsc
e78585586f
ai_helper.put_labels: add show_coords= parameter
2013-07-07 10:50:05 -07:00
mattsc
019b6df9c4
Remove double spaces after periods
...
wmllint complains about this in WML. This is all in Lua code, done for
consistency only.
2013-07-07 10:35:07 -07:00
mattsc
06e896970d
Update ai_helper library
...
New functions print_ts() and print_ts_delta().
Update functions find_best_move() and get_attack_combos().
Use new 1.11.2 syntax and functionality.
2013-05-02 19:57:21 -07:00
Matthias Schoeck
93ba347695
Remove all references to Wesnoth Lua Pack dbms debug function.
...
They were all commented out, but better to remove them altogether.
2012-12-29 20:20:56 +00:00
Matthias Schoeck
7eb57b40dd
Update AI helper library files...
...
...and adjust experimental multiplayer AI code accordingly
2012-12-29 00:36:54 +00:00
Simon Forsyth
5d7c5f6fe6
Improvements to experimental multiplayer AI recruiting
2012-12-22 03:03:48 +00:00
Simon Forsyth
024906af4a
Turn off some comments by new AI on console
2012-11-24 20:46:07 +00:00
Simon Forsyth
6830fc1719
Add new AI
2012-11-24 19:57:11 +00:00