yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
ai_action_parser.h
Go to the documentation of this file.
1#ifndef YAZE_CLI_SERVICE_AI_AI_ACTION_PARSER_H_
2#define YAZE_CLI_SERVICE_AI_AI_ACTION_PARSER_H_
3
4#include <map>
5#include <string>
6#include <vector>
7
8#include "absl/status/statusor.h"
9
10namespace yaze {
11namespace cli {
12namespace ai {
13
18enum class AIActionType {
19 kOpenEditor, // Open a specific editor window
20 kSelectTile, // Select a tile from the tile16 selector
21 kPlaceTile, // Place a tile at a specific position
22 kSaveTile, // Save tile changes to ROM
23 kVerifyTile, // Verify a tile was placed correctly
24 kClickButton, // Click a specific button
25 kWait, // Wait for a duration or condition
26 kScreenshot, // Take a screenshot for verification
28};
29
34struct AIAction {
36 std::map<std::string, std::string> parameters;
37
40 AIAction(AIActionType t, const std::map<std::string, std::string>& params)
41 : type(t), parameters(params) {}
42};
43
54 public:
60 static absl::StatusOr<std::vector<AIAction>> ParseCommand(
61 const std::string& command);
62
66 static std::string ActionToString(const AIAction& action);
67
68 private:
69 static AIActionType ParseActionType(const std::string& verb);
70 static std::map<std::string, std::string> ExtractParameters(
71 const std::string& command, AIActionType type);
72
73 // Pattern matchers for different command types
74 static bool MatchesPlaceTilePattern(const std::string& command,
75 std::map<std::string, std::string>* params);
76 static bool MatchesSelectTilePattern(const std::string& command,
77 std::map<std::string, std::string>* params);
78 static bool MatchesOpenEditorPattern(const std::string& command,
79 std::map<std::string, std::string>* params);
80};
81
82} // namespace ai
83} // namespace cli
84} // namespace yaze
85
86#endif // YAZE_CLI_SERVICE_AI_AI_ACTION_PARSER_H_
Parses natural language commands into structured GUI actions.
static std::map< std::string, std::string > ExtractParameters(const std::string &command, AIActionType type)
static absl::StatusOr< std::vector< AIAction > > ParseCommand(const std::string &command)
static bool MatchesSelectTilePattern(const std::string &command, std::map< std::string, std::string > *params)
static AIActionType ParseActionType(const std::string &verb)
static bool MatchesPlaceTilePattern(const std::string &command, std::map< std::string, std::string > *params)
static bool MatchesOpenEditorPattern(const std::string &command, std::map< std::string, std::string > *params)
static std::string ActionToString(const AIAction &action)
AIActionType
Types of actions the AI can request.
Main namespace for the application.
Definition controller.cc:20
Represents a single action to be performed in the GUI.
AIAction(AIActionType t, const std::map< std::string, std::string > &params)
std::map< std::string, std::string > parameters