Browse Source

docs: 📝 update some documents

tags/0.1.0
DragonAura 2 years ago
parent
commit
38fb49a106
2 changed files with 3 additions and 14 deletions
  1. +2
    -2
      CAPI/Tool_tutorial.md
  2. +1
    -12
      使用文档.md

+ 2
- 2
CAPI/Tool_tutorial.md View File

@@ -4,7 +4,7 @@


## Visual Studio使用说明 ## Visual Studio使用说明


比赛**只保证!!!支持**VS2022,选手使用其他版本后果自负(实际上应该不能编译)。
比赛**只保证!!!支持**VS2022最新版本,选手使用其他版本后果自负(实际上应该不能编译)。


### 生成模式的设置 ### 生成模式的设置


@@ -246,7 +246,7 @@ for (auto itr = begin(arr); itr != end(arr); ++itr)


## Python接口必看 ## Python接口必看


比赛**只保证!!**支持Python3.9,不保证支持其他版本


比赛中的Python接口大多使用异步接口,即返回一个类似于 `Future[bool]` 的值。为了获取实际的值,需要调用 `result()` 方法。 比赛中的Python接口大多使用异步接口,即返回一个类似于 `Future[bool]` 的值。为了获取实际的值,需要调用 `result()` 方法。




+ 1
- 12
使用文档.md View File

@@ -7,26 +7,15 @@
- Windows:先查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴 - Windows:先查看`.\win\CAPI\cpp\`文件夹下是否有`lib`文件夹,没有则https://cloud.tsinghua.edu.cn/d/6972138f641d4e81a446/ 下载并复制粘贴
- Linux:首先自行安装`gRPC`,具体方法可以参考官方教程https://grpc.io/docs/languages/cpp/quickstart/。 - Linux:首先自行安装`gRPC`,具体方法可以参考官方教程https://grpc.io/docs/languages/cpp/quickstart/。
- 然后在`CAPI\cpp\API\src\AI.cpp`中编写代码 - 然后在`CAPI\cpp\API\src\AI.cpp`中编写代码
- 应当编译2次以上,以生成不同的API.exe,
- 为了编译不同PlayerID的代码,我们可以
- 复制若干次AI.cpp
- 利用constexpr
![useif](.\resource\howtouseif.png)
- 对于图中写法,编译前记得更改playerId
- 也可以利用#if、#endif
- Windows:然后用Visual Studio打开`CAPI\cpp\CAPI.sln`编译,注意使用Debug模式 - Windows:然后用Visual Studio打开`CAPI\cpp\CAPI.sln`编译,注意使用Debug模式
- Linux:用`cmake`,对`CAPI\cpp\CMakeLists.txt`进行编译 - Linux:用`cmake`,对`CAPI\cpp\CMakeLists.txt`进行编译
- 每次编译后都在\THUAI6-毕业吧少女\win\CAPI\cpp\x64\Debug中将API.exe重命名并在`RunCpp.cmd`中对应修改地址参数,Linux环境类似
![RunCpp](.\resource\RunCppCmd.png)
- Windows:最后使用`RunCpp.cmd`执行比赛代码 - Windows:最后使用`RunCpp.cmd`执行比赛代码
- Linux:最后使用`RunCpp.sh`执行比赛代码 - Linux:最后使用`RunCpp.sh`执行比赛代码


## Python接口使用说明 ## Python接口使用说明


- 首先在Python环境下运行`GeneratePythonProto.cmd`,以安装必要的包、并生成对应的grpc python文件 - 首先在Python环境下运行`GeneratePythonProto.cmd`,以安装必要的包、并生成对应的grpc python文件
- 复制若干个`CAPI\python\PyAPI`文件夹
- 然后在`CAPI\python\PyAPI0\AI.py`、`CAPI\python\PyAPI1\AI.py`等中编写对应代码并在`RunPython.cmd`中对应修改地址参数,Linux环境类似
![RunPython](.\resource\RunPython.png)
- 然后在`CAPI\python\PyAPI\AI.py`中编写代码
- Windows:最后通过运行`RunPython.cmd`执行比赛代码 - Windows:最后通过运行`RunPython.cmd`执行比赛代码
- Linux:通过运行`RunPython.sh`执行比赛代码 - Linux:通过运行`RunPython.sh`执行比赛代码




Loading…
Cancel
Save