|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include <vector>
- #include <thread>
- #include <array>
- #include "AI.h"
- #include "constants.h"
-
- // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新
- extern const bool asynchronous = false;
-
- // 选手需要依次将player0到player4的职业在这里定义
-
- extern const std::array<THUAI6::StudentType, 4> studentType = {
- THUAI6::StudentType::Athlete,
- THUAI6::StudentType::Teacher,
- THUAI6::StudentType::StraightAStudent,
- THUAI6::StudentType::Sunshine};
-
- extern const THUAI6::TrickerType trickerType = THUAI6::TrickerType::Assassin;
-
- //可以在AI.cpp内部声明变量与函数
-
- void AI::play(IStudentAPI& api)
- {
- // 公共操作
- if (this->playerID == 0)
- {
- // 玩家0执行操作
- }
- else if (this->playerID == 1)
- {
- // 玩家1执行操作
- }
- else if (this->playerID == 2)
- {
- // 玩家2执行操作
- }
- else if (this->playerID == 3)
- {
- // 玩家3执行操作
- }
- //当然可以写成if (this->playerID == 2||this->playerID == 3)之类的操作
- // 公共操作
- }
-
- void AI::play(ITrickerAPI& api)
- {
- auto self = api.GetSelfInfo();
- api.PrintSelfInfo();
- }
|