|
- from memory_Context import *
- from llm import *
-
-
-
-
-
-
- @llm_by_value
- def cli_exit(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "input" and
- (
- c.input == "e" or
- c.input == "exit" or
- c.input == "q" or
- 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
-
-
-
-
-
-
- @llm_by_value
- def cli_goOn(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "outputMatchedItems" and
- len(c.hiddenItems) != len(c.playfieldItems)
- ):
- c.outputGoOn = "Go on:"
- c.recentField = "outputGoOn"
- return c
-
- c.recentField = "none"
- return c
-
-
-
-
-
-
- @llm_by_value
- def cli_greetUser(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "didLaunch" and
- c.didLaunch == True
- ):
- c.outputGreeting = "OGS Memory Command Line Interface"
- c.recentField = "outputGreeting"
- return c
-
- c.recentField = "none"
- return c
-
-
-
-
-
-
- @llm_by_value
- def cli_promptSecondItemSelection(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "selectedItems" and
- len(c.selectedItems) == 1
- ):
- c.outputPromptSelection = "Select the second item now:"
- c.recentField = "outputPromptSelection"
- return c
-
- c.recentField = "none"
- return c
-
-
-
-
-
-
- @llm_by_value
- def cli_reportMatchedItems(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "hiddenItems"
- ):
- c.outputMatchedItems = "Items matched!"
- c.recentField = "outputMatchedItems"
- return c
-
- c.recentField = "none"
- return c
-
-
-
- @llm_by_value
- def cli_reportVictory(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "victory"
- ):
- c.outputVictory = "VICTORY! The game is over now"
- c.recentField = "outputVictory"
- return c
-
- c.recentField = "none"
- return c
-
-
-
-
-
-
- @llm_by_value
- def cli_selectItem(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "input" and
- llm_isDigit(c.input)
- ):
-
-
- c.selectedId = llm_strToInt(c.input) - 1
- c.recentField = "selectedId"
- return c
-
- c.recentField = "none"
- return c
-
-
-
-
-
-
-
- @llm_by_value
- def cli_showHelp(
- c: memory_Context
- ) -> memory_Context:
- if (
- (
- c.recentField == "didLaunch" and
- c.didLaunch == True
- ) or
- (
- c.recentField == "input" and
- c.input == "h"
- ) or
- (
- c.recentField == "input" and
- 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
-
-
-
- @llm_by_value
- def cli_reportMismatchedItems(
- c: memory_Context
- ) -> memory_Context:
- if (
- c.recentField == "mismatchedItems"
- ):
- c.outputMismatchedItems = "Wrong! Try again:"
- c.recentField = "outputMismatchedItems"
- return c
-
- c.recentField = "none"
- return c
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|