|
-
- #include <map>
- #include <string>
- #include <vector>
- #include "ctx.h"
- #include "llm.h"
- #include "memory_Context.h"
- #include "main.h"
-
-
-
-
-
-
- memory_Context cli_exit(
- memory_Context c
- ) {
- if (
- c.recentField == "input" &&
- (
- c.input == "e" ||
- c.input == "exit" ||
- c.input == "q" ||
- c.input == "quit"
- )
- ) {
- c.exit = true;
- c.recentField = "exit";
- return c;
- }
- if (
- c.recentField == "outputVictory"
- ) {
- c.exit = true;
- c.recentField = "exit";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
-
-
-
- memory_Context cli_goOn(
- memory_Context c
- ) {
- if (
- c.recentField == "outputMatchedItems" &&
- c.hiddenItems.size() != c.playfieldItems.size()
- ) {
- c.outputGoOn = "Go on:";
- c.recentField = "outputGoOn";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
-
-
-
- memory_Context cli_greetUser(
- memory_Context c
- ) {
- if (
- c.recentField == "didLaunch" &&
- c.didLaunch == true
- ) {
- c.outputGreeting = "OGS Memory Command Line Interface";
- c.recentField = "outputGreeting";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
-
-
-
- memory_Context cli_promptSecondItemSelection(
- memory_Context c
- ) {
- if (
- c.recentField == "selectedItems" &&
- c.selectedItems.size() == 1
- ) {
- c.outputPromptSelection = "Select the second item now:";
- c.recentField = "outputPromptSelection";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
-
-
-
- memory_Context cli_reportMatchedItems(
- memory_Context c
- ) {
- if (
- c.recentField == "hiddenItems"
- ) {
- c.outputMatchedItems = "Items matched!";
- c.recentField = "outputMatchedItems";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
- memory_Context cli_reportVictory(
- memory_Context c
- ) {
- if (
- c.recentField == "victory"
- ) {
- c.outputVictory = "VICTORY! The game is over now";
- c.recentField = "outputVictory";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
-
-
-
- memory_Context cli_selectItem(
- memory_Context c
- ) {
- if (
- c.recentField == "input" &&
- llm_isDigit(c.input)
- ) {
-
-
- c.selectedId = llm_strToInt(c.input) - 1;
- c.recentField = "selectedId";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
-
-
-
-
- memory_Context cli_showHelp(
- memory_Context c
- ) {
- if (
- (
- c.recentField == "didLaunch" &&
- c.didLaunch == true
- ) ||
- (
- c.recentField == "input" &&
- c.input == "h"
- ) ||
- (
- c.recentField == "input" &&
- c.input == "help"
- )
- ) {
- c.outputHelp = "Commands:\n\te, exit, q, quit\n\t\tExit\n\th, help\n\t\tList commands\n\t1, 2, 3, ...\n\t\tSelect item\nEnter your choice:";
- c.recentField = "outputHelp";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
- memory_Context cli_reportMismatchedItems(
- memory_Context c
- ) {
- if (
- c.recentField == "mismatchedItems"
- ) {
- c.outputMismatchedItems = "Wrong! Try again:";
- c.recentField = "outputMismatchedItems";
- return c;
- }
- c.recentField = "none";
- return c;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|