|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
-
- #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;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|