mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-06-29 00:45:55 +08:00
96a94aaddf
- 构建系统:Makefile 迁移至 CMakeLists.txt,支持 cJSON 和 WinHTTP - 项目结构:src/ 按功能拆分为 core/、gui/、network/、record/、llm/ 子目录 - 新功能:集成大模型 AI(WinHTTP + cJSON,兼容 OpenAI 协议),支持异步请求 - 渲染修复:IupDraw* 替换为 Windows GDI,修复画布黑屏问题 - 网络修复:ENet 初始化幂等化,实现真实 get_local_ip() (Winsock) - 代码质量:删除死代码 (dfs/count_threats_in_direction),修复头文件守卫, sprintf→snprintf 防溢出,strncpy 安全终止,GDI 资源泄漏修复 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
36 lines
978 B
C
36 lines
978 B
C
/**
|
|
* @file llm_ai.h
|
|
* @brief 大模型AI模块头文件
|
|
* @note 通过OpenAI兼容API调用大模型进行五子棋对弈
|
|
*/
|
|
|
|
#ifndef LLM_AI_H
|
|
#define LLM_AI_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
/**
|
|
* @brief 调用大模型获取落子坐标(同步,会阻塞)
|
|
* @param out_x 输出:落子行坐标 (0-based)
|
|
* @param out_y 输出:落子列坐标 (0-based)
|
|
* @return true 获取成功,坐标合法且位置为空
|
|
* @return false 获取失败(网络错误/坐标非法/重试耗尽)
|
|
*/
|
|
bool llm_ai_move(int *out_x, int *out_y);
|
|
|
|
/**
|
|
* @brief 异步启动大模型思考(后台线程)
|
|
* @note 调用后用 llm_ai_poll_result 轮询结果
|
|
*/
|
|
void llm_ai_start_move(void);
|
|
|
|
/**
|
|
* @brief 轮询大模型结果(非阻塞)
|
|
* @param out_x 输出:落子行坐标
|
|
* @param out_y 输出:落子列坐标
|
|
* @return 0 仍在思考, 1 成功获取坐标, -1 失败(应回退算法AI)
|
|
*/
|
|
int llm_ai_poll_result(int *out_x, int *out_y);
|
|
|
|
#endif // LLM_AI_H
|