资源简介
支持8核的中国象棋引擎源码,COONY_HASH_SMP_NEW
代码片段和文件信息
#include
#include
#include “board.h“
#include “piece.h“
#include “data.h“
#include “value.h“
#include “move.h“
/* */
void Board::clear()
{
int i;
for(i=0; i < SquareNb; ++i)
{
if(Square_To_90(i) < 0)
square[i]= -1;
else
square[i]=0;
}
for(i=0; i < 33; ++i)
{
piece[i]=SquareNone;
}
piece_size[Red]=0;
piece_size[Black]=0;
for(i=0; i < 16; ++i)
{
number[i]=0;
};
turn=ColorNone;
for(i=0; i < 9; ++i)
{
rank[i]=file[i]=0;
}
rank[9]=0;
hkey=hlock=0;
ply=0;
for(i=0; i < 512; ++i)
{
histstack[i].clear();
}
}
/* */
void Board::init()
{
init(“rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR w“);
}
/* */
int Board::char2type(char a)
{
switch(a)
{
case ‘K‘:
return RedKing;
case ‘A‘:
return RedAdvisor;
case ‘B‘:
case ‘E‘:
return RedBishop;
case ‘N‘:
case ‘H‘:
return RedKnight;
case ‘R‘:
return RedRook;
case ‘C‘:
return RedCannon;
case ‘P‘:
return RedPawn;
case ‘k‘:
return BlackKing;
case ‘a‘:
return BlackAdvisor;
case ‘b‘:
case ‘e‘:
return BlackBishop;
case ‘n‘:
case ‘h‘:
return BlackKnight;
case ‘r‘:
return BlackRook;
case ‘c‘:
return BlackCannon;
case ‘p‘:
return BlackPawn;
}
return 0;
}
/* */
void Board::init(const char *fen)
{
clear();
int len=strlen(fen);
int i type row col sq=0;
for(i=0; i < len && sq < 90; ++i)
{
if(fen[i] >= ‘0‘ && fen[i] <= ‘9‘)
sq+=fen[i] - ‘0‘;
else if((fen[i] >= ‘a‘ && fen[i] <= ‘z‘) || (fen[i] >= ‘A‘ && fen[i] <= ‘Z‘))
{
if((type=char2type(fen[i])) != 0)
{
piece[Type2Index[type] + number[type]]=Square_From_90(sq);
square[Square_From_90(sq)]=Type2Index[type] + number[type];
number[type]++;
col=Square_File(Square_From_90(sq)) - 3;
row=Square_Rank(Square_From_90(sq)) - 3;
file[col]^=1 << row;
rank[row]^=1 << col;
hkey^=ZobKeyTb[type][Square_From_90(sq)];
hlock^=ZobLockTb[type][Square_From_90(sq)];
piece_size[Piece_Color(type)]++;
}
sq++;
}
}
if(sq == 90)
{
for(; i < len; i++)
{
if(fen[i] == ‘W‘ || fen[i] == ‘w‘ || fen[i] == ‘R‘ || fen[i] == ‘r‘)
{
turn=Red;
break;
}
else i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
.CA.... 44726 2008-10-16 16:14 COONY_HASH_SMP_NEW\board.cpp
.CA.... 1631 2008-10-16 15:24 COONY_HASH_SMP_NEW\board.h
.CA.... 372 2008-10-15 13:34 COONY_HASH_SMP_NEW\color.h
.CA.... 5485 2006-01-25 21:08 COONY_HASH_SMP_NEW\coony.dsp
.CA.... 535 2005-08-13 23:50 COONY_HASH_SMP_NEW\coony.dsw
.CA.... 3262 2005-12-29 14:24 COONY_HASH_SMP_NEW\coony.ico
.CA.... 1688 2005-12-29 14:24 COONY_HASH_SMP_NEW\coony.rc
.CA.... 870 2008-10-15 13:35 COONY_HASH_SMP_NEW\coony.sln
.CA..H. 20480 2008-10-31 22:53 COONY_HASH_SMP_NEW\coony.suo
.CA.... 7692 2008-10-15 13:35 COONY_HASH_SMP_NEW\coony.vcproj
.CA.... 17947 2008-10-23 15:30 COONY_HASH_SMP_NEW\data.cpp
.CA.... 1730 2008-10-15 13:34 COONY_HASH_SMP_NEW\data.h
.CA.... 11478 2006-01-17 17:46 COONY_HASH_SMP_NEW\GPL.txt
.CA.... 3671 2008-10-15 13:34 COONY_HASH_SMP_NEW\hash.cpp
.CA.... 1162 2008-10-15 13:34 COONY_HASH_SMP_NEW\hash.h
.CA.... 1698 2008-10-15 13:34 COONY_HASH_SMP_NEW\list.h
.CA.... 5149 2008-10-31 21:42 COONY_HASH_SMP_NEW\main.cpp
.CA.... 1842 2008-10-16 16:13 COONY_HASH_SMP_NEW\move.cpp
.CA.... 661 2008-10-16 16:13 COONY_HASH_SMP_NEW\move.h
.CA.... 2035 2008-10-15 13:34 COONY_HASH_SMP_NEW\piece.cpp
.CA.... 2283 2008-10-15 13:34 COONY_HASH_SMP_NEW\piece.h
.CA.... 817 2008-10-15 13:34 COONY_HASH_SMP_NEW\pv.cpp
.CA.... 397 2008-10-15 13:34 COONY_HASH_SMP_NEW\pv.h
.CA.... 1683 2008-10-15 13:34 COONY_HASH_SMP_NEW\random.h
.CA.... 68 2006-06-04 21:29 COONY_HASH_SMP_NEW\README.TXT
.CA.... 535 2008-10-15 13:34 COONY_HASH_SMP_NEW\record.h
.CA.... 444 2008-10-15 13:34 COONY_HASH_SMP_NEW\resource.h
.CA.... 19606 2008-10-31 22:49 COONY_HASH_SMP_NEW\search.cpp
.CA.... 2627 2008-10-31 22:11 COONY_HASH_SMP_NEW\search.h
.CA.... 5300 2008-10-15 13:34 COONY_HASH_SMP_NEW\square.cpp
............此处省略10个文件信息
相关资源
- ov7725数字摄像头编程基本知识笔记
- qt TCP网络编程与聊天室的实现
- Nand Flash常见操作及编程实现
- 可编程并行接口8255 实验
- MicroWIN_V4.0 (SP4-SP8)直接安装补丁
- stdio.h 库函数
- NX 测量仪编程CMM解决方案
- 2018年世界编程大赛64KB作品
- Shader编程教程 完整
- 消解原理编程实现含文档
- OpenCV3编程入门及源码百度网盘链接
- shellcode与unicode互相转换器
- 吴恩达深度学习编程练习1-5课附答案
- 基于LabVIEW的数字示波器上可编程触发
- Socket网络编程进阶与实战慕课网课程
- Socket网络编程进阶与实战视频-百度云
- 51单片机数码管动态显示+汇编程序+
- 编程实现原码加减交替除法
- CSP-J、CSP-S学习进阶-2019-10-20.pdf
- HTTP网络编程实验
- 实现读取高度图,设置点光源设置材
- tcl socket 编程
- ADC0809模数转换与显示(汇编程序)
- 16x16汉字点阵字库,单片机编程用
- S7-SCL编程举例
- 邮局选址问题 给定n 个居民
- RDA5876编程指南_v1.3
- qt编程下实现点击按钮调用外部程序
- Coursera吴恩达机器学习课程第二周编程
- 数控车床编程详解(30个
评论
共有 条评论