Михаил Капелько 5 months ago
parent
commit
54c1e2ae9b
3 changed files with 0 additions and 152 deletions
  1. +0
    -52
      v4/shell.cpp
  2. +0
    -9
      v4/shell.h
  3. +0
    -91
      v4/shell.py

+ 0
- 52
v4/shell.cpp View File

@@ -1,52 +0,0 @@
#include <map>
#include <string>
#include <vector>
#include "cli.h"
#include "cli_Context.h"
#include "memory.h"
#include "memory_Context.h"
#include "shell.h"

// Greet the user upon start

shell_Context shell_launch(
shell_Context c
) {
c.cCLI = cli_greetUser(c.cCLI);
c.cCLI.input = "help";
c.cCLI = cli_showHelp(c.cCLI);
c.output = c.cCLI.outputGreeting + "\n" + c.cCLI.outputHelp;
return c;
}

// Switch among CLI functions based on input
//
// Conditions:
// 1. User requested to quit the game
// 2. User plays the game



shell_Context shell_processInput(
shell_Context c
) {
if (
c.input == "e" ||
c.input == "exit" ||
c.input == "q" ||
c.input == "quit"
) {
c.exit = true;
return c;
}
c.cCLI.input = c.input;
c.output = "";
c.cCLI = cli_showHelp(c.cCLI);
if (
c.cCLI.recentField == "outputHelp"
) {
c.output += c.cCLI.outputHelp;
}
return c;
}


+ 0
- 9
v4/shell.h View File

@@ -1,9 +0,0 @@
#include "shell_Context.h"

#ifndef shell_HEADER
#define shell_HEADER

shell_Context shell_launch(shell_Context);
shell_Context shell_processInput(shell_Context);

#endif // shell_HEADER

+ 0
- 91
v4/shell.py View File

@@ -1,91 +0,0 @@
from cli import *
from llm import *
from shell_Context import *

# Greet the user upon start
@llm_by_value
def shell_launch(
c: shell_Context
) -> shell_Context:
c.cCLI = cli_greetUser(c.cCLI)
c.cCLI.input = "help"
c.cCLI = cli_showHelp(c.cCLI)
c.output = c.cCLI.outputGreeting + "\n" + c.cCLI.outputHelp
return c
#}

# Switch among CLI functions based on input
#
# Conditions:
# 1. User requested to quit the game
# 2. User plays the game
@llm_by_value
def shell_processInput(
c: shell_Context
) -> shell_Context:
# Exit
if (
c.input == "e" or
c.input == "exit" or
c.input == "q" or
c.input == "quit"
):
c.exit = True
return c
#}

c.cCLI.input = c.input
c.output = ""

# Help (aka commands)
c.cCLI = cli_showHelp(c.cCLI)
if (
c.cCLI.recentField == "outputHelp"
):
c.output += c.cCLI.outputHelp
#}

c.cCLI = cli_selectItem(c.cCLI)

# Game actions.
if (
c.cCLI.recentField == "cMemory"
):
# Prompt second item.
cli = cli_shouldPromptSelection(c.cCLI)
if (
cli.recentField == "outputPromptSelection"
):
c.output += cli.outputPromptSelection
#}

# Check matching items.
cli = c.cCLI
cli.cMemory = memory_shouldHideMatchingItems(c.cCLI.cMemory)
cli.recentField = "cMemory"
# Report matched items.
cli = cli_shouldReportMatchedItems(cli)
if (
cli.recentField == "outputMatchedItems"
):
c.output += cli.outputMatchedItems
c.cCLI.cMemory = memory
#}

# Check mismatching items.
memory = memory_shouldDeselectMismatchedItems(c.cCLI.cMemory)
c.cCLI.recentField = "cMemory"
# Report mismatched items.
cli = cli_shouldReportMismatchedItems(c.cCLI)
if (
cli.recentField == "outputMismatchedItems"
):
c.output += cli.outputMismatchedItems
c.cCLI.cMemory = memory
#}

#}

return c
#}

Loading…
Cancel
Save