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.

player3.cpp 1.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. //可以在AI.cpp内部声明变量与函数
  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. //当然可以写成if (this->playerID == 2||this->playerID == 3)之类的操作
  36. // 公共操作
  37. }
  38. void AI::play(ITrickerAPI& api)
  39. {
  40. auto self = api.GetSelfInfo();
  41. api.PrintSelfInfo();
  42. }