五子棋人机对战

🎮 Gomoku AI

Play against a heuristic Gomoku AI on a 15x15 board. The engine scores open fours, open threes and other patterns to choose its moves.

📐 工作原理与说明
五子棋 AI 按棋型评分选点:活四(必胜)权重 10000、冲四 1000、活三 1000、眠三 100、活二 100、眠二 10;候选点得分 = 己方成五威胁分 × 攻击系数 + 对方威胁分 × 防守系数;在 15×15 棋盘上对距已有棋子 2 格内的空点逐一评分取最大,可叠加极小极大搜索与 alpha-beta 剪枝。

Formula & Standard References

Item Formula / Note Source / Standard
Win condition five in a row in any direction wins Gomoku rules
Pattern scoring patterns such as open three or four score different weights Game AI practice
Search pruning minimax with alpha-beta pruning searches a limited depth Search algorithms

📈 📈 对战战绩与历史记录

每次完成后自动保存在本机浏览器,可导出 CSV 备份或随时清空。

📚 深度解析:五子棋人机对战

💡 常见使用场景

方法(AI 策略)
规则同五子棋;AI 启发式评估棋盘:优先成五 > 堵对方活四 > 自己做活四/活三 > 堵冲四。当前为单一难度(无搜索深度参数),按棋型权重评估。
算例(演示)
玩家在 (3,3)(3,4)(3,5) 做成活三,AI 优先堵 (3,2) 或 (3,6) 防其成四;若玩家同时有 (5,5)(6,6) 另一活三,AI 只能堵一处,玩家趁另一方向成五获胜。制造「双活三」是赢 AI 的关键。

❓ 常见问题(FAQ)

AI 水平如何?
启发式评估(进攻 1.0 / 防守 1.15 权重),单层棋型打分,不加深层搜索;高水平玩家可用双活三/冲四逼其失误。
能调整先手吗?
玩家固定执黑先手,AI 执白后手应战;当前不提供先手切换与难度调节,定位为单一难度人机练习。