Merge pull request #6783 from mattsc/expai_updates

Some fixes to the Experimental AI
This commit is contained in:
mattsc 2022-06-24 16:37:59 -07:00 committed by GitHub
commit a70ecf1ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1088 additions and 54 deletions

View File

@ -59,7 +59,7 @@ end
local ca_castle_switch = {}
function ca_castle_switch:evaluation(cfg, data, filter_own, recruiting_leader)
-- @recruiting_leader is passed from the recuit_rushers CA for the leader_takes_village()
-- @recruiting_leader is passed from the recuit_rushers CA for the leader_takes_villages evaluation
-- evaluation. If it is set, we do the castle switch evaluation only for that leader
local start_time, ca_name = wesnoth.ms_since_init() / 1000., 'castle_switch'

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
wesnoth.deprecated_message('ai/lua/generic_recruit_engine.lua', 3, '1.19', 'All its functionality has been moved to ai/lua/ca_recruit_rushers.lua which can now be used directly.')
return {
-- init parameters:
-- ai_cas: an object reference to store the CAs and associated data

View File

@ -1,22 +0,0 @@
local internal_recruit_cas = {}
local internal_params = {}
-- The following external engine creates the CA functions recruit_rushers_eval and recruit_rushers_exec
-- It also exposes find_best_recruit and find_best_recruit_hex for use by other recruit engines
wesnoth.require("ai/lua/generic_recruit_engine.lua").init(internal_recruit_cas, internal_params)
local ca_recruit_rushers = {}
function ca_recruit_rushers:evaluation(cfg)
internal_params.high_level_fraction = cfg.high_level_fraction
internal_params.randomness = cfg.randomness
internal_params.score_function = function() return cfg.ca_score end
return internal_recruit_cas:recruit_rushers_eval()
end
function ca_recruit_rushers:execution()
return internal_recruit_cas:recruit_rushers_exec()
end
return ca_recruit_rushers

View File

@ -21,7 +21,7 @@ function wesnoth.micro_ais.recruit_rushers(cfg)
local optional_keys = { "high_level_fraction", "randomness" }
local CA_parms = {
ai_id = 'mai_rusher_recruit',
{ ca_id = "move", location = 'ca_recruit_rushers.lua', score = cfg.ca_score or 180000 }
{ ca_id = "move", location = '../../lua/ca_recruit_rushers.lua', score = cfg.ca_score or 180000 }
}
handle_default_recruitment(cfg)