Research portable Memory game | Исследовать портируемую игру Память
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

50 lines
921B

  1. from cli import *
  2. from shell_Context import *
  3. from llm import *
  4. # Greet the user upon start
  5. @llm_by_value
  6. def shell_start(
  7. c: shell_Context
  8. ) -> shell_Context:
  9. c.cCLI = cli_greetUser(c.cCLI)
  10. c.cCLI.input = "help"
  11. c.cCLI = cli_showHelp(c.cCLI)
  12. c.output = c.cCLI.outputGreeting + "\n" + c.cCLI.outputHelp
  13. c.recentField = "output"
  14. return c
  15. #}
  16. # Switch among CLI functions based on input
  17. #
  18. # Conditions:
  19. # 1. User requested to quit the game
  20. # 2. User plays the game
  21. @llm_by_value
  22. def shell_processInput(
  23. c: shell_Context
  24. ) -> shell_Context:
  25. if (
  26. c.input == "e" or
  27. c.input == "exit" or
  28. c.input == "q" or
  29. c.input == "quit"
  30. ):
  31. c.exit = True
  32. c.recentField = "exit"
  33. return c
  34. c.cCLI.input = c.input
  35. c.output = ""
  36. c.cCLI = cli_showHelp(c.cCLI)
  37. if (
  38. c.cCLI.recentField == "outputHelp"
  39. ):
  40. c.output += c.cCLI.outputHelp
  41. c.recentField = "output"
  42. return c
  43. #}