mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-05-10 02:19:46 +08:00
v7.0: 代码架构重构完成 - 模块化设计、配置统一管理、类型定义标准化
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#define AI_H
|
||||
|
||||
#include "gobang.h"
|
||||
#include "type.h"
|
||||
|
||||
/**
|
||||
* @brief 评估一个落子位置的综合得分(结合进攻和防守)
|
||||
@@ -44,4 +45,38 @@ int dfs(int x, int y, int player, int depth, int alpha, int beta, bool is_maximi
|
||||
*/
|
||||
void ai_move(int depth);
|
||||
|
||||
// ==================== AI增强:新增函数声明 ====================
|
||||
|
||||
/**
|
||||
* @brief 生成候选移动并按评估分数排序
|
||||
* @param moves 存储候选移动的数组
|
||||
* @param player 当前玩家
|
||||
* @return 候选移动数量
|
||||
*/
|
||||
int generate_candidate_moves(ScoredMove *moves, int player);
|
||||
|
||||
/**
|
||||
* @brief 检查位置是否在已有棋子附近
|
||||
* @param x, y 要检查的位置
|
||||
* @return 如果附近有棋子返回true
|
||||
*/
|
||||
bool is_near_stones(int x, int y);
|
||||
|
||||
/**
|
||||
* @brief 检测在指定位置落子的威胁等级
|
||||
* @param x, y 落子位置
|
||||
* @param player 落子玩家
|
||||
* @return 威胁等级
|
||||
*/
|
||||
ThreatLevel detect_threat(int x, int y, int player);
|
||||
|
||||
/**
|
||||
* @brief 计算指定方向的威胁数量
|
||||
* @param x, y 起始位置
|
||||
* @param dx, dy 方向向量
|
||||
* @param player 玩家
|
||||
* @return 威胁数量
|
||||
*/
|
||||
int count_threats_in_direction(int x, int y, int dx, int dy, int player);
|
||||
|
||||
#endif // AI_H
|
||||
Reference in New Issue
Block a user