资源简介
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++图书信息管理系统使用链表写的
相关资源
- 基于POP3、SMTP协议的MFC实现邮件客户端
- 五子棋AI代码 启发式搜索+算杀 内置禁
- openCV中stitching_detailed.cpp
- C++五子棋源码有AI,先手禁手
- Python3+Opencv343环境搭建 dll load failed问
- playfair 算法及其C语言模拟实现
- main.cpp
- c++小游戏五子棋,带AI
- Raize Components 6.1.12 for C++builder XE10的安
- ege实现小游戏maincpp
- MFC规则DLL(MFC Regular DLL)添加DLLMain(
- Aitken加速法算法用c++描述
- ais数据解码
- 斗地主AI源代码
- C++ Primer Plus 第6版 中文版 PDF 完整
- 麻将游戏AI源代码
- C++ 标准库第2版 作者: Nicolai M. Josu
- PICT工具C++源码
- 基于S32K148 TBOX(s32k148_sai_sgtl5000)
- C++ 使用RAISERROR语句返回错误信息
- C++ 使用WAITFOR语句延期执行语句
- nRF52 BLE配置(main.c)
- Brainfuck语言解释器
- windows 线程池(ThreadPoolMain.cpp)
- c++黑白棋ai游戏源码(带背景音乐)
- VS2015C++利用SMTP发送邮件的支持附件发
- ThoughtWorks 笔试题 Trains C++版实现
- C++斗地主(附带简单AI)
- 中国象棋AI算法 C/C++
评论
共有 条评论