Михаил Капелько 5 months ago
parent
commit
c9140d5ed2
11 changed files with 55 additions and 5 deletions
  1. +2
    -0
      v4/cli.cpp
  2. +2
    -0
      v4/cli_test.cpp
  3. +15
    -0
      v4/ctx.h
  4. +1
    -1
      v4/ctx.py
  5. +2
    -0
      v4/llm_test.cpp
  6. +2
    -2
      v4/main.py
  7. +2
    -0
      v4/memory.cpp
  8. +19
    -0
      v4/memory_Context.cpp
  9. +5
    -1
      v4/memory_Context.h
  10. +2
    -0
      v4/memory_test.cpp
  11. +3
    -1
      v4/tPythonC++/CPP.py

+ 2
- 0
v4/cli.cpp View File

@@ -1,6 +1,8 @@

#include <map>
#include <string>
#include <vector>
#include "ctx.h"
#include "llm.h"
#include "memory_Context.h"
#include "main.h"


+ 2
- 0
v4/cli_test.cpp View File

@@ -1,6 +1,8 @@

#include <map>
#include <string>
#include <vector>
#include "ctx.h"
#include "llm.h"
#include "memory_Context.h"
#include "main.h"


+ 15
- 0
v4/ctx.h View File

@@ -0,0 +1,15 @@
#include <string>
#include <vector>

#ifndef ctx_HEADER
#define ctx_HEADER

template <class T> class ctx_Controller {
T context;

ctx_Controller(const T &c) {
context = c;
}
};

#endif // ctx_HEADER

v4/Controller.py → v4/ctx.py View File

@@ -1,6 +1,6 @@
import copy

class Controller:
class ctx_Controller:
def __init__(self, c):
self.callbacks = []
self.context = c

+ 2
- 0
v4/llm_test.cpp View File

@@ -1,6 +1,8 @@

#include <map>
#include <string>
#include <vector>
#include "ctx.h"
#include "llm.h"
#include "memory_Context.h"
#include "main.h"


+ 2
- 2
v4/main.py View File

@@ -1,9 +1,9 @@
from cli import *
from cli_test import *
from ctx import *
from llm_test import *
from llm_test_Python import *
from memory_test import *
from Controller import *
import sys

print(llm_test_Python_copyByValue())
@@ -35,7 +35,7 @@ print(cli_test_reportMatchedItems())
print(cli_test_reportMismatchedItems())
print(cli_test_reportVictory())

ctrl = Controller(memory_createContext())
ctrl = ctx_Controller(memory_createContext())
ctrl.registerFunctions([
cli_exit,
cli_goOn,


+ 2
- 0
v4/memory.cpp View File

@@ -1,6 +1,8 @@

#include <map>
#include <string>
#include <vector>
#include "ctx.h"
#include "llm.h"
#include "memory_Context.h"
#include "main.h"


+ 19
- 0
v4/memory_Context.cpp View File

@@ -1,5 +1,24 @@
#include "memory_Context.h"


template <typename T> T memory_Context::field(const std::string &fieldName) {
if (fieldName == "didLaunch") {
return didLaunch;
}

// TODO

return 0;
}

template <typename T> void memory_Context::setField(const std::string &fieldName, T value) {
if (fieldName == "didLaunch") {
didLaunch = value;
}

// TODO
}

memory_Context memory_createContext() {
return memory_Context();
}

+ 5
- 1
v4/memory_Context.h View File

@@ -1,6 +1,7 @@
#include <map>
#include <string>
#include <vector>
#include "ctx.h"

#ifndef memory_Context_HEADER
#define memory_Context_HEADER
@@ -11,6 +12,7 @@ struct memory_Context {
std::string input = "";
std::vector<int> hiddenItems;
std::vector<int> mismatchedItems;
std::string recentField = "none";
std::string outputGoOn = "";
std::string outputGreeting = "";
std::string outputHelp = "";
@@ -20,10 +22,12 @@ struct memory_Context {
std::string outputVictory = "";
std::map<int, int> playfieldItems;
int playfieldSize = 0;
std::string recentField = "none";
int selectedId = -1;
std::vector<int> selectedItems;
bool victory = false;

template <typename T> T field(const std::string &fieldName);
template <typename T> void setField(const std::string &fieldName, T value);
};

memory_Context memory_createContext();


+ 2
- 0
v4/memory_test.cpp View File

@@ -1,6 +1,8 @@

#include <map>
#include <string>
#include <vector>
#include "ctx.h"
#include "llm.h"
#include "memory_Context.h"
#include "main.h"


+ 3
- 1
v4/tPythonC++/CPP.py View File

@@ -1,9 +1,11 @@
from Function import *

def includes():
return """#include <map>
return """
#include <map>
#include <string>
#include <vector>
#include "ctx.h"
#include "llm.h"
#include "memory_Context.h"
#include "main.h"


Loading…
Cancel
Save