?? data.c
字號:
//data.c
#include <stdio.h>
/*
Board representation
**************************
0
| \
| 1
| /\
|/ \
2─━3 Assigned a number N
| /| associated with
| / | each intersection
|/ |
4─━5 on board
| /|
| / |
|/ |
6─━7
| /|
| / |
|/ |
8─━9
︱‖∥∕/\﹨∥∣
Here, we track the position by recording each stone's intersecion on
board. The structure stoneIntersection[] is initialized by the initial
position.
*************************************************************************
*/
int stoneIntersection[3] = {0, 8, 9};
/*
************************************************************************
Pre-table for move generation
******************************
preTable[color][from][moveIndex]= to, to ∈[0, 9].
1) In this table, a valid move is represented by a number between
0 and 9; the value INV means no more moves.
2) Where, color == 0, red stone moves pre-table; color == 1, blue
stone moves pre-table.
*************************************************************************
*/
#define INV -1
//對照上面的棋盤編碼圖,并參照牛角棋的規則,可有如下預置表
int preTable[2][10][5] =
{
{ /*red stone moves table*/
{2, 1, INV}, {2, 3, 0, INV},
{4, 3, 1, 0, INV}, {5, 4, 2, 1, INV},
{6, 5, 3, 2, INV}, {7, 6, 4, 3, INV},
{8, 7, 5, 4, INV}, {9, 8, 6, 5, INV},
{9, 7, 6, INV}, {8, 7, INV},
},
{ /*blue stone moves table*/
{INV}, {0, INV},
{3, 1, 0, INV}, {2, 1, INV},
{2, 3, 5, INV}, {3, 4, INV},
{4, 5, 7, INV}, {5, 6, INV},
{6, 7, 9, INV}, {7, 8, INV},
},
};
/*
************************************************************************
Global data for search
*************************************************************************
*/
#define MAXDEPTH 100
int moveList[1024]; //著法列表
int* pList[MAXDEPTH+2]; //各層著法列表的首地址
int maxDepth; //當前的最大搜索深度
int bestRootMove;
int rootAlpha;
int rootBeta;
/*
************************************************************************
repetition detected
*************************************************************************
*/
int posStack[MAXDEPTH]; //保存歷史局面,用于探測循環
/*
************************************************************************
Other global data
*************************************************************************
*/
int side; //哪一方
int newGame;
FILE *inputStream;
char *args[256];
int nArgs;
char buffer[512];
char cmdBuffer[4096];
unsigned int timeRemaining; //本方剩余的總時間
unsigned int oTimeRemaining; //對手剩余的總時間
int traceOut = 1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -