void pmap(int *m, int col);\r
void pboard(int *b);\r
void pbytes(unsigned char *b);\r
+int myRandom();\r
\r
typedef struct {\r
int lock[5];\r
int attackMaps[200*BSIZE], *attacks = attackMaps;\r
char distance[2*BSIZE]; // distance table\r
char promoBoard[BSIZE]; // flags to indicate promotion zones\r
-char rawFire[BSIZE+2*BWMAX]; // flags to indicate squares controlled by Fire Demons\r
+unsigned char rawFire[BSIZE+2*BWMAX]; // flags to indicate squares controlled by Fire Demons\r
signed char PST[7*BSIZE];\r
\r
#define board (rawBoard + 6*BHMAX + 3)\r
int\r
EasyProm (signed char *r)\r
{\r
- int i;\r
if(r[0] == X) return 30 + PROMO*((unsigned int)(r[1] | r[2] | r[3] | r[5] | r[6] | r[7]) <= 1);\r
if(r[1] == X || r[7] == X) return 30 + PROMO/2;\r
return 0;\r
void\r
Compactify (int stm)\r
{ // remove pieces that are permanently gone (captured or promoted) from one side's piece list\r
- int i, j, k;\r
+ int i, k;\r
for(i=stm+2; i<=last[stm]; i+=2) { // first pass: unpromoted pieces\r
if((k = p[i].promo) >= 0 && p[i].pos == ABSENT) { // unpromoted piece no longer there\r
p[k].promo = -2; // orphan promoted version\r
}\r
\r
void\r
-SetUp(char *array, int var)\r
+SetUp (char *array, int var)\r
{\r
- int i, j, n, m, nr, color;\r
- char c, *q, name[3], prince = 0;\r
+ int i, j, n, m, color;\r
+ char c, name[3], prince = 0;\r
PieceDesc *p1, *p2;\r
last[WHITE] = 1; last[BLACK] = 0;\r
royal[WHITE] = royal[BLACK] = 0;\r
char rowMask[] = { 0100, 0140, 0160, 070, 034, 016, 07, 03, 01 };\r
char rows[9];\r
\r
-int\r
+void\r
AreaStep (int from, int x, int flags, int n, int d)\r
{\r
int i;\r
}\r
}\r
\r
-int\r
+void\r
AreaMoves (int from, int piece, int range)\r
{\r
int i;\r
int\r
MapOneColor (int start, int last, int *map)\r
{\r
- int i, j, k, totMob = 0;\r
+ int i, j, totMob = 0;\r
for(i=start+2; i<=last; i+=2) {\r
int mob = 0;\r
if(p[i].pos == ABSENT) continue;\r
}\r
\r
void\r
-GenCapts(int sqr, int victimValue)\r
+GenCapts (int sqr, int victimValue)\r
{ // generate all moves that capture the piece on the given square\r
- int i, range, att = attacks[2*sqr + stm];\r
+ int i, att = attacks[2*sqr + stm];\r
//printf("GenCapts(%c%d,%d) %08x\n",sqr%BW+'a',sqr/BW,victimValue,att);\r
if(!att) return; // no attackers at all!\r
for(i=0; i<8; i++) { // try all rays\r
- int x, v, jumper, jcapt=0;\r
+ int x, v, jcapt=0;\r
if(att & attackMask[i]) { // attacked by move in this direction\r
v = -kStep[i]; x = sqr;\r
while( board[x+=v] == EMPTY ); // scan towards source until we encounter a 'stop'\r
int\r
ReadSquare (char *p, int *sqr)\r
{\r
- int i=0, f, r;\r
+ int f, r;\r
f = p[0] - 'a';\r
r = atoi(p + 1) - ONE;\r
*sqr = r*BW + f;\r
int\r
SearchBestMove (MOVE *move, MOVE *ponderMove)\r
{\r
- int score, i;\r
+ int score;\r
printf("# SearchBestMove\n");\r
startTime = GetTickCount();\r
nodes = 0;\r
}\r
}\r
\r
+ int\r
main()\r
{\r
int engineSide=NONE; // side played by engine\r
if(!strcmp(command, "remove")) { stm = TakeBack(2); continue; }\r
printf("Error: unknown command\n");\r
}\r
+ return 0;\r
}\r
\r