Right before coverage destroys everything.

This commit is contained in:
Zed A. Shaw 2025-03-16 23:17:43 -04:00
parent 1d2968f826
commit c4611c0138
9 changed files with 54 additions and 46 deletions

6
ai.cpp
View file

@ -18,7 +18,6 @@ namespace ai {
Action config_action(AIProfile& profile, nlohmann::json& config) {
check(config.contains("name"), "config_action: action config missing name");
check(config.contains("cost"), "config_action: action config missing cost");
// check(config["cost"] < STATE_MAX, "config_action: action cost is greater than STATE_MAX");
Action result(config["name"], config["cost"]);
@ -62,7 +61,7 @@ namespace ai {
AIMGR.actions.clear();
AIMGR.states.clear();
AIMGR.scripts.clear();
AIMGR.profile = R"({})"_json;
AIMGR.profile = json({});
}
void init(std::string config_path) {
@ -140,6 +139,9 @@ namespace ai {
}
ActionPlan plan(std::string script_name, State start, State goal) {
// BUG: could probably memoize here, since:
// same script+same start+same goal will/should produce the same results
check(initialized, "you forgot to initialize the AI first.");
auto script = load_script(script_name);
return plan_actions(script, start, goal);