• 大小: 38KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-08
  • 语言: 其他
  • 标签: 编程  

资源简介

支持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个文件信息

评论

共有 条评论