Now have the ability to do partial solutions that will create potential paths to the goal, and a test that runs the scripts from plans in different scenarios. Also, this ai_debug thing needs some work.

This commit is contained in:
Zed A. Shaw 2025-03-11 15:33:14 -04:00
parent 3f83d3f0bb
commit fc66d221d4
11 changed files with 252 additions and 107 deletions

11
ai.hpp
View file

@ -10,13 +10,15 @@
namespace ai {
struct AIManager {
nlohmann::json profile;
AIProfile profile;
std::unordered_map<std::string, Action> actions;
std::unordered_map<std::string, State> states;
std::unordered_map<std::string, std::vector<Action>> scripts;
};
/* This is really only used in test to load different fixtures. */
void reset();
void init(std::string config_path);
Action config_action(nlohmann::json& profile, nlohmann::json& config);
@ -27,5 +29,10 @@ namespace ai {
Action load_action(std::string action_name);
std::vector<Action> load_script(std::string script_name);
std::optional<Script> plan(std::string script_name, State start, State goal);
void set(State& state, std::string name, bool value=true);
bool test(State state, std::string name);
ActionPlan plan(std::string script_name, State start, State goal);
/* Mostly used for debugging and validation. */
AIProfile* profile();
}