Research portable Memory game | Исследовать портируемую игру Память
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

main.cpp 2.8KB

5ヶ月前
5ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include "any.h"
  5. #include "ctx_test2.h"
  6. #include "llm.h"
  7. #include "main.h"
  8. #include "memory_Context.h"
  9. int main() {
  10. std::cout
  11. << test_ctx_Controller_executeFunctions_registerFunction_set()
  12. << std::endl
  13. << test_ctx_Controller_processQueue()
  14. << std::endl
  15. << test_ctx_Controller_registerFieldCallback_match()
  16. << std::endl
  17. << test_ctx_Controller_registerFieldCallback_mismatch()
  18. << std::endl
  19. << test_memory_Context_field()
  20. << std::endl
  21. << test_memory_Context_setField()
  22. << std::endl
  23. << llm_test_isDigit_digit()
  24. << std::endl
  25. << llm_test_isDigit_notDigit()
  26. << std::endl
  27. << llm_test_strToInt()
  28. << std::endl
  29. ;
  30. std::cout
  31. << memory_test_detectMismatchedItems()
  32. << std::endl
  33. << memory_test_detectMismatchedItems_itemTwice()
  34. << std::endl
  35. << memory_test_detectVictory()
  36. << std::endl
  37. << memory_test_generateConstPlayfield()
  38. << std::endl
  39. << memory_test_hideMatchingItems()
  40. << std::endl
  41. << memory_test_selectItem_1x()
  42. << std::endl
  43. << memory_test_selectItem_2x()
  44. << std::endl
  45. << memory_test_selectItem_3x()
  46. << std::endl
  47. ;
  48. std::cout
  49. << cli_test_exit_e()
  50. << std::endl
  51. << cli_test_exit_exit()
  52. << std::endl
  53. << cli_test_exit_victory()
  54. << std::endl
  55. << cli_test_exit_q()
  56. << std::endl
  57. << cli_test_exit_quit()
  58. << std::endl
  59. << cli_test_goOn()
  60. << std::endl
  61. << cli_test_greetUser()
  62. << std::endl
  63. << cli_test_showHelp_h()
  64. << std::endl
  65. << cli_test_showHelp_help()
  66. << std::endl
  67. << cli_test_selectItem()
  68. << std::endl
  69. << cli_test_promptSecondItemSelection()
  70. << std::endl
  71. << cli_test_reportMatchedItems()
  72. << std::endl
  73. << cli_test_reportMismatchedItems()
  74. << std::endl
  75. << cli_test_reportVictory()
  76. << std::endl
  77. ;
  78. ctx_Controller<memory_Context> ctrl(memory_createContext());
  79. ctrl.registerFunctions({
  80. cli_exit,
  81. cli_goOn,
  82. cli_greetUser,
  83. cli_promptSecondItemSelection,
  84. cli_reportMatchedItems,
  85. cli_reportMismatchedItems,
  86. cli_reportVictory,
  87. cli_selectItem,
  88. cli_showHelp,
  89. memory_detectMismatchedItems,
  90. memory_detectVictory,
  91. memory_generateConstPlayfield,
  92. memory_hideMatchingItems,
  93. memory_selectItem,
  94. });
  95. auto printOutput = [](memory_Context c) {
  96. if (llm_startsWith(c.recentField, "output")) {
  97. std::cout
  98. << libany::any_cast<std::string>(c.field(c.recentField))
  99. << std::endl;
  100. }
  101. };
  102. ctrl.registerCallback(printOutput);
  103. ctrl.registerFieldCallback("exit", [](memory_Context c) { exit(0); });
  104. ctrl.set("didLaunch", true);
  105. ctrl.set("playfieldSize", 2);
  106. while (true) {
  107. std::string ln;
  108. getline(std::cin, ln);
  109. ctrl.set("input", ln);
  110. }
  111. }