from cli import * from cli_test import * from memory_test import * from Controller import * import sys print(memory_test_detectMismatchedItems()) print(memory_test_detectMismatchedItems_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_victory()) print(cli_test_exit_q()) print(cli_test_exit_quit()) print(cli_test_goOn()) print(cli_test_greetUser()) print(cli_test_showHelp_h()) print(cli_test_showHelp_help()) print(cli_test_selectItem()) print(cli_test_promptSecondItemSelection()) print(cli_test_reportMatchedItems()) print(cli_test_reportMismatchedItems()) print(cli_test_reportVictory()) ctrl = Controller(memory_createContext()) ctrl.registerFunction(cli_exit) ctrl.registerFunction(cli_goOn) ctrl.registerFunction(cli_greetUser) ctrl.registerFunction(cli_promptSecondItemSelection) ctrl.registerFunction(cli_reportMatchedItems) ctrl.registerFunction(cli_reportMismatchedItems) ctrl.registerFunction(cli_reportVictory) ctrl.registerFunction(cli_selectItem) ctrl.registerFunction(cli_showHelp) ctrl.registerFunction(memory_detectMismatchedItems) ctrl.registerFunction(memory_detectVictory) ctrl.registerFunction(memory_generateConstPlayfield) ctrl.registerFunction(memory_hideMatchingItems) ctrl.registerFunction(memory_selectItem) def printOutput(c): if c.recentField.startswith("output"): print(c.field(c.recentField)) ctrl.registerCallback(printOutput) #ctrl.registerCallback(lambda c: print(f"ИГР App.dbg ctx: '{c}'")) ctrl.registerFieldCallback("exit", lambda c: sys.exit(0)) ctrl.set("didLaunch", True) ctrl.set("playfieldSize", 2) for line in sys.stdin: ln = line.rstrip() ctrl.set("input", ln)