#include #include #include #include "AI.h" #include "constants.h" // 注意不要使用conio.h,Windows.h等非标准库 // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新,大致一帧更新一次 extern const bool asynchronous = false; // 选手需要依次将player0到player4的职业在这里定义 extern const std::array 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) // 每帧执行一次AI::play(IStudentAPI& api)或AI::play(ITrickerAPI& api)(除非执行该函数超过一帧50ms),获取的信息都是这一帧的开始的状态 { // 公共操作 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(); }