Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6KB

  1. from cli import *
  2. from cli_test import *
  3. from memory_test import *
  4. from Controller import *
  5. import sys
  6. print(memory_test_deselectMismatchedItems())
  7. print(memory_test_deselectMismatchedItems_itemTwice())
  8. print(memory_test_detectVictory())
  9. print(memory_test_generateConstPlayfield())
  10. print(memory_test_hideMatchingItems())
  11. print(memory_test_selectItem_1x())
  12. print(memory_test_selectItem_2x())
  13. print(memory_test_selectItem_3x())
  14. print(cli_test_exit_e())
  15. print(cli_test_exit_exit())
  16. print(cli_test_exit_q())
  17. print(cli_test_exit_quit())
  18. print(cli_test_greetUser())
  19. print(cli_test_showHelp_h())
  20. print(cli_test_showHelp_help())
  21. print(cli_test_selectItem())
  22. print(cli_test_promptSecondItemSelection())
  23. print(cli_test_reportMatchedItems())
  24. ctrl = Controller(memory_createContext())
  25. ctrl.registerFunction(cli_exit)
  26. ctrl.registerFunction(cli_greetUser)
  27. ctrl.registerFunction(cli_promptSecondItemSelection)
  28. ctrl.registerFunction(cli_reportMatchedItems)
  29. ctrl.registerFunction(cli_selectItem)
  30. ctrl.registerFunction(cli_showHelp)
  31. ctrl.registerFunction(memory_deselectMismatchedItems)
  32. ctrl.registerFunction(memory_detectVictory)
  33. ctrl.registerFunction(memory_generateConstPlayfield)
  34. ctrl.registerFunction(memory_hideMatchingItems)
  35. ctrl.registerFunction(memory_selectItem)
  36. def printOutput(c):
  37. if c.recentField.startswith("output"):
  38. print(getattr(c, c.recentField))
  39. ctrl.registerCallback(printOutput)
  40. #ctrl.registerCallback(lambda c: print(f"ИГР App.dbg ctx: '{c}'"))
  41. ctrl.registerFieldCallback("exit", lambda c: sys.exit(0))
  42. ctrl.set("didLaunch", True)
  43. ctrl.set("playfieldSize", 2)
  44. for line in sys.stdin:
  45. ln = line.rstrip()
  46. ctrl.set("input", ln)