资源简介
Gomoku AI including Minimax, Heuristic Evaluation, Alpha-Beta Pruning, pre-evaluate, Iterative Deepening, VCT/VCF, PVS, killer heuristic search, dynamic multi-thread(not very dynamic).
Renju rule
代码片段和文件信息
/*
Gomoku AI including Minimax Heuristic Evaluation Alpha-Beta Pruning pre-evaluate Iterative Deepening VCT/VCF PVS
killer heuristic search High Expectation Test(invented by myself) dynamic multi-thread(not very dynamic)
Writtern by Liv
*/
#include
#include
#include
#include
#include
#pragma comment(lib“pthreadVC2.lib“)
#define max(xy) ((x)>(y)?(x):(y))
#define min(xy) ((x)<(y)?(x):(y))
#define abs(x) (((x)>=0)?(x):(-(x)))
#define BOARD_SIZE 15
#define NO_CHESS “┼“
#define BLACK_CHESS “○“
#define WHITE_CHESS “●“
#define CURRENT_BLACK “△“
#define CURRENT_WHITE “▲“
#define DEPTH 8 //the depth of Minimax
#define FIVE 100000
#define ALIVE_FOUR 50000
#define RUSH_FOUR 2000
#define ALIVE_THREE 2000
#define RUSH_THREE 200
#define ALIVE_TWO 200
#define RUSH_TWO 20
#define ALIVE_ONE 1
#define NOW_WIN 10000000
#define ONE_WIN 1000000
#define OCCUPIED -200000000
#define INITIAL -300000000
#define HASH_SIZE 262144 //power(218)
#define PVS_PARAMETER 3
#define HET_PARAMETER 2500
#define PVS_MAX 20 //most considerd point nunmber
#define THREAD_NUMBER 4
#define LOCK_SIZE 4096 //power(212)
struct can{ //candidate move point
int value;
int xp; //x position
int yp; //y position
int count[4][7]; //AI part alive_fourrush_fouralive_threerush_threealive_tworush_twoalive_one for 4 orientation
int ver_count[4][7]; //human part alive_fourrush_fouralive_threerush_threealive_tworush_twoalive_one for 4 orientation
int sum[2][7]; //0 for AI 1 for human
};
struct lines{ //record pattern such as alive four
int rowline[2][BOARD_SIZE][7]; //alive_fourrush_fouralive_threerush_threealive_tworush_twoalive_one 0 for AI 1 for human //row
int colline[2][BOARD_SIZE][7]; //column
int lcolline[2][2*BOARD_SIZE-1][7]; //from (min_xmin_y) to (max_xmax_y)
int rcolline[2][2*BOARD_SIZE-1][7]; //from (min_xmax_y) to (max_xmin_y)
int sum[2][7]; //sum four orientation
};
struct para_func{ //parameter for function MultiThread_Minimax in consider of multi-thread design
int (*Che_Val)[BOARD_SIZE]; //digital chess board
int *b_i; //candidate i
int colo; //color
int depth;
int *best; //now best sore
int *b_x*b_y; //position of best point
int *pvs; //pvs number
int whe_main_thread; //whether it is main thread
unsigned long long int chara; //character code
struct can *candi;
struct lines* count;
};
char *Chess[BOARD_SIZE][BOARD_SIZE]; //storage chesses
int Chess_Val[THREAD_NUMBER][BOARD_SIZE][BOARD_SIZE]; //value of chess 1 for black 1000 for white
int Chess_Val_pon[THREAD_NUMBER][BOARD_SIZE][BOARD_SIZE]; //for unachieved feature pondering
char *color; //recent color
char *playercolor;
int win; //whether anyone wins
unsigned long long int zobrist_list[BOARD_SIZE][BOARD_SIZE][2]; //1 for black 0 fo
- 上一篇:funcode 打飞虫c语言源码
- 下一篇:C++图书信息管理系统使用链表写的
相关资源
- C++17 In Detail
- stm32 BootLoader程序(main.c)
- stm32 实现Fatfs对U盘文件操作(main.c)
- 链表实现学生管理系统(main.c)
- 银行家算法分配资源的模拟实现(m
- 转 VC++ 实现电子邮件(Email)发送
- C++17 The Complete Guide
- 井字棋三连棋的AI实现,C/C++
- c语言实现Paillier算法原理与实现
- Hoo WinTail 最新版本(v4.2.982)破解补丁
- c++实现发邮件类
- MFC下的Email邮箱软件
- 五子棋mfc,带ai,附教程
- 安装oracle11g的一些所缺失的rpm包
- SMTP发送邮件程序支持SSL和TLS
- C++编写五子棋带AI,mfc,附教程
- email加密源程序
- VC6下开发的des邮件加密系统
- Dynamic TWAIN ActiveX 3.0(含注册机)
- 经典手眼标定算法C++代码
- 基于OpenCV的步态能量图源代码GEI Gai
- 使用C++实现多项式的运算
- 基于MFCC的GMM的说话人识别.rar
- MFC解决窗口保存及重绘闪烁问题的一
- c语言程序设计课设 大鱼吃小鱼
- 数据结构与面向对象程序设计(C++版
- 加入射击功能和AI的贪吃蛇
- MFC 象棋 完备功能 含有AI
- 计算机考研资料
- Raize Components 6.2.3 for Delphi 10.3 Rio(F
评论
共有 条评论