from cli import * from cli_test import * from memory_test import * from Controller import * import sys print(memory_test_deselectMismatchedItems()) print(memory_test_deselectMismatchedItems_itemTwice()) print(memory_test_detectVictory()) print(memory_test_generateConstPlayfield()) print(memory_test_hideMatchingItems()) print(memory_test_selectItem_1x()) print(memory_test_selectItem_2x()) print(memory_test_selectItem_3x()) print(cli_test_exit_e()) print(cli_test_exit_exit()) print(cli_test_exit_q()) print(cli_test_exit_quit()) print(cli_test_greetUser()) print(cli_test_showHelp_h()) print(cli_test_showHelp_help()) #print(cli_test_selectItem()) #print(cli_test_shouldPromptSelection()) ##print(cli_test_shouldReportIvalidItemSelection_outOfBoundsMin()) ctrl = Controller(memory_createContext()) ctrl.registerFunction(cli_exit) ctrl.registerFunction(cli_greetUser) ctrl.registerFunction(cli_showHelp) def printOutput(c): if c.recentField.startswith("output"): print(getattr(c, c.recentField)) ctrl.registerCallback(printOutput) #ctrl.registerCallback(lambda c: print(f"ИГР App.dbg ctx: '{c}'")) ctrl.registerFieldCallback("exit", lambda c: sys.exit(0)) # #c = shell_createContext() #c.cCLI = cli_createContext() #c.cCLI.cMemory = memory_createContext() #c.cCLI.cMemory.playfieldSize = 2 #c.cCLI.cMemory = memory_generateConstPlayfield(c.cCLI.cMemory) # #c = shell_launch(c) #print(c.output) # ctrl.set("didLaunch", True) for line in sys.stdin: ln = line.rstrip() ctrl.set("input", ln)