优化AI参数配置:使用DEFAULT_DEFENSE_COEFFICIENT并更新相关注释

This commit is contained in:
2025-07-21 00:18:11 +08:00
parent 6bd2289722
commit 504868c739
3 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -37,8 +37,8 @@
#define DEFAULT_TIME_LIMIT 30 // 默认时间限制为30秒(内部存储)
//---------- AI参数 ----------//
#define DEFAULT_AI_DEPTH 5 // 默认AI搜索深度(从3提升到5
#define DEFAULT_DEFENSE_COEFFICIENT 1.5 // 默认防守系数(从1.2提升到1.5
#define DEFAULT_AI_DEPTH 5 // 默认AI搜索深度
#define DEFAULT_DEFENSE_COEFFICIENT 1.5 // 默认防守系数
//---------- 网络参数 ----------//
#define DEFAULT_NETWORK_PORT 8888 // 默认网络端口
+7 -7
View File
@@ -349,18 +349,18 @@ void run_ai_game()
scores_calculated = 0;
// AI对战模式
int AI_DEPTH = 3;
int AI_DEPTH = DEFAULT_AI_DEPTH;
AI_DEPTH = get_integer_input("请选择AI难度(1~5), 数字越大越强,注意数字越大AI思考时间越长!):", 1, 5);
/**
* @brief AI的防守系数,系数越大越倾向于防守
* @note 1~1.2
* 2~1.3
* 3~1.4
* 4~1.5
* 5~1.6
* @note 1~1.5
* 2~1.6
* 3~1.7
* 4~1.8
* 5~1.9
*/
defense_coefficient = 1.2 + (AI_DEPTH - 1) * 0.1;
defense_coefficient = DEFAULT_DEFENSE_COEFFICIENT + (AI_DEPTH - 1) * 0.1;
empty_board();
int current_player = determine_first_player(PLAYER, AI);
+1 -1
View File
@@ -11,7 +11,7 @@
* @brief 将指令复制到powershell
* gcc -std=c17 -o gobang.exe *.c -lws2_32
.\gobang.exe
* gcc 为编译器,添加了network.c网络模块,-lws2_32链接Windows网络库
* gcc 为编译器,添加了-lws2_32链接Windows网络库
*/
int main(int argc, char *argv[])