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.

61 line
1.8KB

  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_detectMismatchedItems())
  7. print(memory_test_detectMismatchedItems_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_victory())
  17. print(cli_test_exit_q())
  18. print(cli_test_exit_quit())
  19. print(cli_test_goOn())
  20. print(cli_test_greetUser())
  21. print(cli_test_showHelp_h())
  22. print(cli_test_showHelp_help())
  23. print(cli_test_selectItem())
  24. print(cli_test_promptSecondItemSelection())
  25. print(cli_test_reportMatchedItems())
  26. print(cli_test_reportMismatchedItems())
  27. print(cli_test_reportVictory())
  28. ctrl = Controller(memory_createContext())
  29. ctrl.registerFunction(cli_exit)
  30. ctrl.registerFunction(cli_goOn)
  31. ctrl.registerFunction(cli_greetUser)
  32. ctrl.registerFunction(cli_promptSecondItemSelection)
  33. ctrl.registerFunction(cli_reportMatchedItems)
  34. ctrl.registerFunction(cli_reportMismatchedItems)
  35. ctrl.registerFunction(cli_reportVictory)
  36. ctrl.registerFunction(cli_selectItem)
  37. ctrl.registerFunction(cli_showHelp)
  38. ctrl.registerFunction(memory_detectMismatchedItems)
  39. ctrl.registerFunction(memory_detectVictory)
  40. ctrl.registerFunction(memory_generateConstPlayfield)
  41. ctrl.registerFunction(memory_hideMatchingItems)
  42. ctrl.registerFunction(memory_selectItem)
  43. def printOutput(c):
  44. if c.recentField.startswith("output"):
  45. print(c.field(c.recentField))
  46. ctrl.registerCallback(printOutput)
  47. #ctrl.registerCallback(lambda c: print(f"ИГР App.dbg ctx: '{c}'"))
  48. ctrl.registerFieldCallback("exit", lambda c: sys.exit(0))
  49. ctrl.set("didLaunch", True)
  50. ctrl.set("playfieldSize", 2)
  51. for line in sys.stdin:
  52. ln = line.rstrip()
  53. ctrl.set("input", ln)