diff --git a/CAPI/cpp/API/src/AI.cpp b/CAPI/cpp/API/src/AI.cpp index 6895409..6152fd0 100644 --- a/CAPI/cpp/API/src/AI.cpp +++ b/CAPI/cpp/API/src/AI.cpp @@ -5,7 +5,7 @@ #include "constants.h" // 注意不要使用conio.h,Windows.h等非标准库 -// 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新 +// 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新,大致一帧更新一次 extern const bool asynchronous = false; // 选手需要依次将player0到player4的职业在这里定义 diff --git a/CAPI/python/PyAPI/AI.py b/CAPI/python/PyAPI/AI.py index 09af335..740f7cb 100644 --- a/CAPI/python/PyAPI/AI.py +++ b/CAPI/python/PyAPI/AI.py @@ -8,7 +8,7 @@ import time class Setting: - # 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新 + # 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新,大致一帧更新一次 @staticmethod def asynchronous() -> bool: return False diff --git a/docs/CAPI接口(cpp).md b/docs/CAPI接口(cpp).md index 8fba77c..b427644 100644 --- a/docs/CAPI接口(cpp).md +++ b/docs/CAPI接口(cpp).md @@ -88,6 +88,14 @@ void PrintSelfInfo() const; ~~~ +### 部分属性解释 stuctures.h +~~~c++ + struct Player + { + std::vector props;//大小固定为3,空的位置为NullPropType + } +~~~ + ## 接口一览 ~~~c++ // 指挥本角色进行移动,`timeInMilliseconds` 为移动时间,单位为毫秒;`angleInRadian` 表示移动的方向,单位是弧度,使用极坐标——竖直向下方向为 x 轴,水平向右方向为 y 轴 diff --git a/docs/CAPI接口(python).md b/docs/CAPI接口(python).md index bfbf84d..500da59 100644 --- a/docs/CAPI接口(python).md +++ b/docs/CAPI接口(python).md @@ -80,7 +80,6 @@ - `def IsDoorOpen(self, cellX: int, cellY: int) -> bool`:查询特定位置门是否开启,没有门/不在视野内也返回false - `def GetHiddenGateState(self, cellX: int, cellY: int) -> THUAI6.HiddenGateState`::查询特定位置隐藏校门状态,没有隐藏校门/不在视野内返回THUAI6::HiddenGateState::Null - #### 其他 - `def GetGameInfo(self) -> THUAI6.GameInfo`:查询当前游戏状态 @@ -105,6 +104,13 @@ def PrintSelfInfo(self) -> None: ~~~ +### 部分属性解释 stuctures.h +~~~python +class Player: + def __init__(self, **kwargs) -> None: + self.prop: List[PropType] = []//大小固定为3,空的位置为NullPropType +~~~ + ## 接口一览 ~~~python diff --git a/docs/QandA.md b/docs/QandA.md index ae141da..6995cec 100644 --- a/docs/QandA.md +++ b/docs/QandA.md @@ -22,11 +22,6 @@ Q:卡死在第一帧不动 A:大概率是你的代码死循环了 -Q: 怎么开始游戏? - -A: -需要确保学生阵营和捣蛋鬼阵营的人数都达到Server.cmd中设定的值。人数不足也可以打开WPF,参考使用文档,修改RunGUIClient.cmd的参数,然后运行RunGUIClient.cmd,这样可以通过WPF运行部分客户端,来达到人数限制。 - ## C++ Q:显示API项目已卸载 @@ -54,6 +49,15 @@ Q:CAPI编译不通过(第二种) A:查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴 +Q:编译好慢啊 + +A: +1. 尽量不要改其他文件,甚至连点下保存都别点 +2. 不要点重新生成,要点生成 +3. 开启下图选项 +![CompileFaster](https://raw.githubusercontent.com/shangfengh/THUAI6/new/resource/CompileFaster.png) + + ## Python ### grpc版本更新失败 @@ -76,4 +80,4 @@ A:初赛结束会调数值及机制,增加新角色 Q:初赛后会修改什么呢? -A:技能冷却时间等属性设为不可见;出生点随机性或可选性;增强教师等职业,削弱职业;规范Debug信息 \ No newline at end of file +A:技能冷却时间等属性设为不可见;出生点随机性或可选性;增强教师等职业,削弱职业;规范Debug信息;提供不同格式的信息传递;增加职业;优化游戏结束条件 \ No newline at end of file diff --git a/docs/使用文档.md b/docs/使用文档.md index 12aa824..b9f3d46 100644 --- a/docs/使用文档.md +++ b/docs/使用文档.md @@ -14,7 +14,7 @@ - Windows:先查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴 - Linux:首先自行安装`gRPC`,具体方法可以参考官方教程https://grpc.io/docs/languages/cpp/quickstart/。 - 然后在`CAPI\cpp\API\src\AI.cpp`中编写代码 - - 选手不应当修改`AI.cpp`中原来有的代码,除了`void AI::play(IStudentAPI& api)`和`void AI::play(ITrickerAPI& api)` + - 选手不应当修改`AI.cpp`中原来有的代码,除了`void AI::play(IStudentAPI& api)`和`void AI::play(ITrickerAPI& api)`,及修改asynchronous的返回值 - 每帧执行一次`AI::play(IStudentAPI& api)`或`AI::play(ITrickerAPI& api)`(除非执行该函数超过一帧50ms),获取的信息都是这一帧的开始的状态 - 选手可以在`AI.cpp`内`void AI::play`外新增函数和变量 - Windows:然后用Visual Studio打开`CAPI\cpp\CAPI.sln`编译,注意使用Debug模式 @@ -26,7 +26,7 @@ - 首先在Python环境下运行`GeneratePythonProto.cmd`,以安装必要的包、并生成对应的grpc python文件 - 然后在`CAPI\python\PyAPI\AI.py`中编写代码 - - 选手不应当修改`AI.py`中原来有的代码,除了`StudentPlay(self, api: IStudentAPI)`和`TrickerPlay(self, api: ITrickerAPI)` + - 选手不应当修改`AI.py`中原来有的代码,除了`StudentPlay(self, api: IStudentAPI)`和`TrickerPlay(self, api: ITrickerAPI)`,及修改asynchronous的返回值 - 每帧执行一次`AI::play(IStudentAPI& api)`或`AI::play(ITrickerAPI& api)`(除非执行该函数超过一帧50ms),获取的信息都是这一帧的开始的状态 - 选手可以在`AI.py`内新增函数和变量 - Windows:最后通过运行`RunPython.cmd`执行比赛代码 diff --git a/logic/GameClass/GameObj/Map/Map.cs b/logic/GameClass/GameObj/Map/Map.cs index 1a5eafa..427c76d 100644 --- a/logic/GameClass/GameObj/Map/Map.cs +++ b/logic/GameClass/GameObj/Map/Map.cs @@ -23,7 +23,7 @@ namespace GameClass.GameObj if (GameData.numOfStudent - NumOfDeceasedStudent - NumOfEscapedStudent == 1) { - GameObjLockDict[GameObjType.EmergencyExit].EnterReadLock(); + GameObjLockDict[GameObjType.EmergencyExit].EnterWriteLock(); try { foreach (EmergencyExit emergencyExit in GameObjDict[GameObjType.EmergencyExit]) @@ -35,7 +35,7 @@ namespace GameClass.GameObj } finally { - GameObjLockDict[GameObjType.EmergencyExit].ExitReadLock(); + GameObjLockDict[GameObjType.EmergencyExit].ExitWriteLock(); } } } diff --git a/resource/CompileFaster.png b/resource/CompileFaster.png new file mode 100644 index 0000000..f27537d Binary files /dev/null and b/resource/CompileFaster.png differ