You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

AI.cpp 1.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <vector>
  2. #include <thread>
  3. #include <array>
  4. #include "AI.h"
  5. #include "constants.h"
  6. // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新
  7. extern const bool asynchronous = false;
  8. // 选手需要依次将player0到player4的职业在这里定义
  9. extern const std::array<THUAI6::StudentType, 4> studentType = {
  10. THUAI6::StudentType::Athlete,
  11. THUAI6::StudentType::Teacher,
  12. THUAI6::StudentType::StraightAStudent,
  13. THUAI6::StudentType::Sunshine};
  14. extern const THUAI6::TrickerType trickerType = THUAI6::TrickerType::Assassin;
  15. // 选手只需写一个即可,为了调试方便写了两个的话也不会有影响
  16. void AI::play(IStudentAPI& api)
  17. {
  18. // 公共操作
  19. if (this->playerID == 0)
  20. {
  21. // 玩家0执行操作
  22. }
  23. else if (this->playerID == 1)
  24. {
  25. // 玩家1执行操作
  26. }
  27. else if (this->playerID == 2)
  28. {
  29. // 玩家2执行操作
  30. }
  31. else if (this->playerID == 3)
  32. {
  33. // 玩家3执行操作
  34. }
  35. // 公共操作
  36. }
  37. void AI::play(ITrickerAPI& api)
  38. {
  39. auto self = api.GetSelfInfo();
  40. api.PrintSelfInfo();
  41. }