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 962 B

12345678910111213141516171819202122232425262728293031
  1. #include <vector>
  2. #include <thread>
  3. #include "AI.h"
  4. #include "constants.h"
  5. // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新
  6. extern const bool asynchronous = false;
  7. // 选手必须定义该变量来选择自己的阵营
  8. extern const THUAI6::PlayerType playerType = THUAI6::PlayerType::TrickerPlayer;
  9. // 选手需要将两个都定义,本份代码中不选择的阵营任意定义即可
  10. extern const THUAI6::TrickerType trickerType = THUAI6::TrickerType::Assassin;
  11. extern const THUAI6::StudentType studentType = THUAI6::StudentType::Athlete;
  12. // 选手只需写一个即可,为了调试方便写了两个的话也不会有影响
  13. void AI::play(IStudentAPI& api)
  14. {
  15. api.PrintTricker();
  16. }
  17. void AI::play(ITrickerAPI& api)
  18. {
  19. if (api.HaveMessage())
  20. {
  21. auto msg = api.GetMessage();
  22. api.Print("Message from " + std::to_string(msg.first) + ": " + msg.second);
  23. }
  24. }