Category : A Collection of Games for DOS and Windows
Archive   : OTHELLO.ZIP
Filename : SCOREPOS.C
#include
/* DESCRIPTION OF THE SCORING FUNCTION:
II I
1 A B C D | D C B A I know this looks complicated, but the object
2 B E F G | G F E B is to maximize coefficient acurracy. In this
3 C F H I | I H F C way, every tiny detail can be scrutinized.
4 D G I J | J I G D Note the symmetry: vertical, horizontal,
--------+--------
5 D G I J | J I G D and diagonal. Combinations must be analyzed.
6 C F H I | I H F C Once that is done, the significantly complex
7 B E F G | G F E B score can be implemented sans tree.
8 A B C D | D C B A
I - IV : quadrants
A B C D E F G H 1 - 7 : rows
III IV A - H : columns
Factors are as follows ( counting the ocurrence of):
The program's:
[1] A [11] Permanent pieces (cannot be changed)
[2] B [12] A - C without B in same quadrant
[3] C [13] A - D without B & C in same quadrant
[4] D [14] A - D without B xor C in the same quadrant
[5] E [15] E without A in same quadrant
[6] F [16] B without A in same quadrant
[7] G [17] B - D **
[8] H [18] C - D **
[9] I [19] Mobility onto edge
[10] J [20] Mobility
[21] - [40]: the same as [1] - [19], except for the opponent
** Probable negative factors
*/
#include "color.h"
#include "othello.h"
extern int *weight;
/* Returns the score of the position from the computer's standpoint */
int score_pos(board,ret_ndx)
BOARD board;
int *ret_ndx; /* Array returning the factors */
/* Sum ret_ndx[i] * Coeff[i] = score */
/* i = 1 to MAX_FACTOR */
/* Specifics of the factors are above */
{
int i,j,pos_score;
for(i = 1; i <= MAX_FACTOR; i++) ret_ndx[i] = 0;
if(board[0][0] == COMPUTER) ret_ndx[1]++;
if(board[0][7] == COMPUTER) ret_ndx[1]++;
if(board[7][0] == COMPUTER) ret_ndx[1]++;
if(board[7][7] == COMPUTER) ret_ndx[1]++;
if(board[0][1] == COMPUTER) ret_ndx[2]++;
if(board[0][6] == COMPUTER) ret_ndx[2]++;
if(board[1][0] == COMPUTER) ret_ndx[2]++;
if(board[1][7] == COMPUTER) ret_ndx[2]++;
if(board[6][0] == COMPUTER) ret_ndx[2]++;
if(board[6][7] == COMPUTER) ret_ndx[2]++;
if(board[7][1] == COMPUTER) ret_ndx[2]++;
if(board[7][6] == COMPUTER) ret_ndx[2]++;
if(board[0][2] == COMPUTER) ret_ndx[3]++;
if(board[0][5] == COMPUTER) ret_ndx[3]++;
if(board[2][0] == COMPUTER) ret_ndx[3]++;
if(board[2][7] == COMPUTER) ret_ndx[3]++;
if(board[5][0] == COMPUTER) ret_ndx[3]++;
if(board[5][7] == COMPUTER) ret_ndx[3]++;
if(board[7][2] == COMPUTER) ret_ndx[3]++;
if(board[7][5] == COMPUTER) ret_ndx[3]++;
if(board[0][3] == COMPUTER) ret_ndx[4]++;
if(board[0][4] == COMPUTER) ret_ndx[4]++;
if(board[3][0] == COMPUTER) ret_ndx[4]++;
if(board[3][7] == COMPUTER) ret_ndx[4]++;
if(board[4][0] == COMPUTER) ret_ndx[4]++;
if(board[4][7] == COMPUTER) ret_ndx[4]++;
if(board[7][3] == COMPUTER) ret_ndx[4]++;
if(board[7][4] == COMPUTER) ret_ndx[4]++;
if(board[1][1] == COMPUTER) ret_ndx[5]++;
if(board[1][6] == COMPUTER) ret_ndx[5]++;
if(board[6][1] == COMPUTER) ret_ndx[5]++;
if(board[6][6] == COMPUTER) ret_ndx[5]++;
if(board[1][2] == COMPUTER) ret_ndx[6]++;
if(board[1][5] == COMPUTER) ret_ndx[6]++;
if(board[2][1] == COMPUTER) ret_ndx[6]++;
if(board[2][6] == COMPUTER) ret_ndx[6]++;
if(board[5][1] == COMPUTER) ret_ndx[6]++;
if(board[5][6] == COMPUTER) ret_ndx[6]++;
if(board[6][2] == COMPUTER) ret_ndx[6]++;
if(board[6][5] == COMPUTER) ret_ndx[6]++;
if(board[1][3] == COMPUTER) ret_ndx[7]++;
if(board[1][4] == COMPUTER) ret_ndx[7]++;
if(board[3][1] == COMPUTER) ret_ndx[7]++;
if(board[3][6] == COMPUTER) ret_ndx[7]++;
if(board[4][1] == COMPUTER) ret_ndx[7]++;
if(board[4][6] == COMPUTER) ret_ndx[7]++;
if(board[6][3] == COMPUTER) ret_ndx[7]++;
if(board[6][4] == COMPUTER) ret_ndx[7]++;
if(board[2][2] == COMPUTER) ret_ndx[8]++;
if(board[2][5] == COMPUTER) ret_ndx[8]++;
if(board[5][2] == COMPUTER) ret_ndx[8]++;
if(board[5][5] == COMPUTER) ret_ndx[8]++;
if(board[2][3] == COMPUTER) ret_ndx[9]++;
if(board[2][4] == COMPUTER) ret_ndx[9]++;
if(board[3][2] == COMPUTER) ret_ndx[9]++;
if(board[3][5] == COMPUTER) ret_ndx[9]++;
if(board[4][2] == COMPUTER) ret_ndx[9]++;
if(board[4][5] == COMPUTER) ret_ndx[9]++;
if(board[5][3] == COMPUTER) ret_ndx[9]++;
if(board[5][4] == COMPUTER) ret_ndx[9]++;
if(board[3][3] == COMPUTER) ret_ndx[10]++;
if(board[3][4] == COMPUTER) ret_ndx[10]++;
if(board[4][3] == COMPUTER) ret_ndx[10]++;
if(board[4][4] == COMPUTER) ret_ndx[10]++;
/*********************************************/
if(board[0][0] == PLAYER) ret_ndx[21]++;
if(board[0][7] == PLAYER) ret_ndx[21]++;
if(board[7][0] == PLAYER) ret_ndx[21]++;
if(board[7][7] == PLAYER) ret_ndx[21]++;
if(board[0][1] == PLAYER) ret_ndx[22]++;
if(board[0][6] == PLAYER) ret_ndx[22]++;
if(board[1][0] == PLAYER) ret_ndx[22]++;
if(board[1][7] == PLAYER) ret_ndx[22]++;
if(board[6][0] == PLAYER) ret_ndx[22]++;
if(board[6][7] == PLAYER) ret_ndx[22]++;
if(board[7][1] == PLAYER) ret_ndx[22]++;
if(board[7][6] == PLAYER) ret_ndx[22]++;
if(board[0][2] == PLAYER) ret_ndx[23]++;
if(board[0][5] == PLAYER) ret_ndx[23]++;
if(board[2][0] == PLAYER) ret_ndx[23]++;
if(board[2][7] == PLAYER) ret_ndx[23]++;
if(board[5][0] == PLAYER) ret_ndx[23]++;
if(board[5][7] == PLAYER) ret_ndx[23]++;
if(board[7][2] == PLAYER) ret_ndx[23]++;
if(board[7][5] == PLAYER) ret_ndx[23]++;
if(board[0][3] == PLAYER) ret_ndx[24]++;
if(board[0][4] == PLAYER) ret_ndx[24]++;
if(board[3][0] == PLAYER) ret_ndx[24]++;
if(board[3][7] == PLAYER) ret_ndx[24]++;
if(board[4][0] == PLAYER) ret_ndx[24]++;
if(board[4][7] == PLAYER) ret_ndx[24]++;
if(board[7][3] == PLAYER) ret_ndx[24]++;
if(board[7][4] == PLAYER) ret_ndx[24]++;
if(board[1][1] == PLAYER) ret_ndx[25]++;
if(board[1][6] == PLAYER) ret_ndx[25]++;
if(board[6][1] == PLAYER) ret_ndx[25]++;
if(board[6][6] == PLAYER) ret_ndx[25]++;
if(board[1][2] == PLAYER) ret_ndx[26]++;
if(board[1][5] == PLAYER) ret_ndx[26]++;
if(board[2][1] == PLAYER) ret_ndx[26]++;
if(board[2][6] == PLAYER) ret_ndx[26]++;
if(board[5][1] == PLAYER) ret_ndx[26]++;
if(board[5][6] == PLAYER) ret_ndx[26]++;
if(board[6][2] == PLAYER) ret_ndx[26]++;
if(board[6][5] == PLAYER) ret_ndx[26]++;
if(board[1][3] == PLAYER) ret_ndx[27]++;
if(board[1][4] == PLAYER) ret_ndx[27]++;
if(board[3][1] == PLAYER) ret_ndx[27]++;
if(board[3][6] == PLAYER) ret_ndx[27]++;
if(board[4][1] == PLAYER) ret_ndx[27]++;
if(board[4][6] == PLAYER) ret_ndx[27]++;
if(board[6][3] == PLAYER) ret_ndx[27]++;
if(board[6][4] == PLAYER) ret_ndx[27]++;
if(board[2][2] == PLAYER) ret_ndx[28]++;
if(board[2][5] == PLAYER) ret_ndx[28]++;
if(board[5][2] == PLAYER) ret_ndx[28]++;
if(board[5][5] == PLAYER) ret_ndx[28]++;
if(board[2][3] == PLAYER) ret_ndx[29]++;
if(board[2][4] == PLAYER) ret_ndx[29]++;
if(board[3][2] == PLAYER) ret_ndx[29]++;
if(board[3][5] == PLAYER) ret_ndx[29]++;
if(board[4][2] == PLAYER) ret_ndx[29]++;
if(board[4][5] == PLAYER) ret_ndx[29]++;
if(board[5][3] == PLAYER) ret_ndx[29]++;
if(board[5][4] == PLAYER) ret_ndx[29]++;
if(board[3][3] == PLAYER) ret_ndx[30]++;
if(board[3][4] == PLAYER) ret_ndx[30]++;
if(board[4][3] == PLAYER) ret_ndx[30]++;
if(board[4][4] == PLAYER) ret_ndx[30]++;
/********************************************/
ret_ndx[11] = perm_pieces(board,COMPUTER);
/********************************************/
if(board[0][0] == COMPUTER && board[0][2] == COMPUTER
&& board[0][1] != COMPUTER) ret_ndx[12]++;
if(board[0][0] == COMPUTER && board[2][0] == COMPUTER
&& board[1][0] != COMPUTER) ret_ndx[12]++;
if(board[0][7] == COMPUTER && board[0][5] == COMPUTER
&& board[0][6] != COMPUTER) ret_ndx[12]++;
if(board[0][7] == COMPUTER && board[2][7] == COMPUTER
&& board[1][7] != COMPUTER) ret_ndx[12]++;
if(board[7][0] == COMPUTER && board[5][0] == COMPUTER
&& board[6][0] != COMPUTER) ret_ndx[12]++;
if(board[7][0] == COMPUTER && board[7][2] == COMPUTER
&& board[7][1] != COMPUTER) ret_ndx[12]++;
if(board[7][7] == COMPUTER && board[5][7] == COMPUTER
&& board[6][7] != COMPUTER) ret_ndx[12]++;
if(board[7][7] == COMPUTER && board[7][5] == COMPUTER
&& board[7][6] != COMPUTER) ret_ndx[12]++;
/********************************************/
if(board[0][0] == COMPUTER && board[0][3] == COMPUTER
&& board[0][1] != COMPUTER && board[0][2] != COMPUTER) ret_ndx[13]++;
if(board[0][0] == COMPUTER && board[3][0] == COMPUTER
&& board[2][0] != COMPUTER && board[1][0] != COMPUTER) ret_ndx[13]++;
if(board[0][7] == COMPUTER && board[0][4] == COMPUTER
&& board[0][5] != COMPUTER && board[0][6] != COMPUTER) ret_ndx[13]++;
if(board[0][7] == COMPUTER && board[3][7] == COMPUTER
&& board[1][7] != COMPUTER && board[2][7] != COMPUTER) ret_ndx[13]++;
if(board[7][0] == COMPUTER && board[7][4] == COMPUTER
&& board[7][2] != COMPUTER && board[7][3] != COMPUTER) ret_ndx[13]++;
if(board[7][0] == COMPUTER && board[4][0] == COMPUTER
&& board[5][0] != COMPUTER && board[6][0] != COMPUTER) ret_ndx[13]++;
if(board[7][7] == COMPUTER && board[7][4] == COMPUTER
&& board[7][5] != COMPUTER && board[7][6] != COMPUTER) ret_ndx[13]++;
if(board[7][7] == COMPUTER && board[4][7] == COMPUTER
&& board[5][7] != COMPUTER && board[6][7] != COMPUTER) ret_ndx[13]++;
/**********************************************/
if(board[1][1] == COMPUTER && board[0][0] == EMPTY) ret_ndx[15]++;
if(board[1][6] == COMPUTER && board[0][7] == EMPTY) ret_ndx[15]++;
if(board[6][1] == COMPUTER && board[7][0] == EMPTY) ret_ndx[15]++;
if(board[6][6] == COMPUTER && board[7][7] == EMPTY) ret_ndx[15]++;
/**********************************************/
if(board[0][0] == EMPTY && board[0][1] == COMPUTER) ret_ndx[16]++;
if(board[0][0] == EMPTY && board[1][0] == COMPUTER) ret_ndx[16]++;
if(board[0][7] == EMPTY && board[0][6] == COMPUTER) ret_ndx[16]++;
if(board[0][7] == EMPTY && board[1][7] == COMPUTER) ret_ndx[16]++;
if(board[7][0] == EMPTY && board[6][0] == COMPUTER) ret_ndx[16]++;
if(board[7][0] == EMPTY && board[7][1] == COMPUTER) ret_ndx[16]++;
if(board[7][7] == EMPTY && board[6][7] == COMPUTER) ret_ndx[16]++;
if(board[7][7] == EMPTY && board[7][6] == COMPUTER) ret_ndx[16]++;
/********************************************/
if(board[0][1] == COMPUTER && board[0][3] == COMPUTER
&& board[0][2] == EMPTY) ret_ndx[17]++;
if(board[1][0] == COMPUTER && board[3][0] == COMPUTER
&& board[2][0] == EMPTY) ret_ndx[17]++;
if(board[0][6] == COMPUTER && board[0][4] == COMPUTER
&& board[0][5] == EMPTY) ret_ndx[17]++;
if(board[1][7] == COMPUTER && board[3][7] == COMPUTER
&& board[2][7] == EMPTY) ret_ndx[17]++;
if(board[7][1] == COMPUTER && board[7][3] == COMPUTER
&& board[7][2] == EMPTY) ret_ndx[17]++;
if(board[6][0] == COMPUTER && board[4][0] == COMPUTER
&& board[5][0] == EMPTY) ret_ndx[17]++;
if(board[7][6] == COMPUTER && board[7][4] == COMPUTER
&& board[7][5] == EMPTY) ret_ndx[17]++;
if(board[6][7] == COMPUTER && board[4][7] == COMPUTER
&& board[5][7] == EMPTY) ret_ndx[17]++;
/**********************************************/
if(board[0][2] == COMPUTER && board[0][3] == COMPUTER) ret_ndx[18]++;
if(board[2][0] == COMPUTER && board[3][0] == COMPUTER) ret_ndx[18]++;
if(board[0][5] == COMPUTER && board[0][4] == COMPUTER) ret_ndx[18]++;
if(board[2][7] == COMPUTER && board[3][7] == COMPUTER) ret_ndx[18]++;
if(board[7][2] == COMPUTER && board[7][3] == COMPUTER) ret_ndx[18]++;
if(board[5][0] == COMPUTER && board[4][0] == COMPUTER) ret_ndx[18]++;
if(board[7][5] == COMPUTER && board[7][4] == COMPUTER) ret_ndx[18]++;
if(board[5][7] == COMPUTER && board[4][7] == COMPUTER) ret_ndx[18]++;
/**********************************************/
for(i = 0; i < 8; i++)
{
if(is_legal(board,COMPUTER,0,i)) ret_ndx[19]++;
if(is_legal(board,COMPUTER,i,0)) ret_ndx[19]++;
if(is_legal(board,COMPUTER,7,i)) ret_ndx[19]++;
if(is_legal(board,COMPUTER,i,7)) ret_ndx[19]++;
}
/**********************************************/
for(i = 1; i < 7; i++)
for(j = 1; j < 7; j++)
if(is_legal(board,COMPUTER,i,j)) ret_ndx[20]++;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
ret_ndx[31] = perm_pieces(board,PLAYER);
/**********************************************/
if(board[0][0] == PLAYER && board[0][2] == PLAYER
&& board[0][1] != PLAYER) ret_ndx[32]++;
if(board[0][0] == PLAYER && board[2][0] == PLAYER
&& board[1][0] != PLAYER) ret_ndx[32]++;
if(board[0][7] == PLAYER && board[0][5] == PLAYER
&& board[0][6] != PLAYER) ret_ndx[32]++;
if(board[0][7] == PLAYER && board[2][7] == PLAYER
&& board[1][7] != PLAYER) ret_ndx[32]++;
if(board[7][0] == PLAYER && board[5][0] == PLAYER
&& board[6][0] != PLAYER) ret_ndx[32]++;
if(board[7][0] == PLAYER && board[7][2] == PLAYER
&& board[7][1] != PLAYER) ret_ndx[32]++;
if(board[7][7] == PLAYER && board[5][7] == PLAYER
&& board[6][7] != PLAYER) ret_ndx[32]++;
if(board[7][7] == PLAYER && board[7][5] == PLAYER
&& board[7][6] != PLAYER) ret_ndx[32]++;
/********************************************/
if(board[0][0] == PLAYER && board[0][3] == PLAYER
&& board[0][1] != PLAYER && board[0][2] != PLAYER) ret_ndx[33]++;
if(board[0][0] == PLAYER && board[3][0] == PLAYER
&& board[2][0] != PLAYER && board[1][0] != PLAYER) ret_ndx[33]++;
if(board[0][7] == PLAYER && board[0][4] == PLAYER
&& board[0][5] != PLAYER && board[0][6] != PLAYER) ret_ndx[33]++;
if(board[0][7] == PLAYER && board[3][7] == PLAYER
&& board[1][7] != PLAYER && board[2][7] != PLAYER) ret_ndx[33]++;
if(board[7][0] == PLAYER && board[7][4] == PLAYER
&& board[7][2] != PLAYER && board[7][3] != PLAYER) ret_ndx[33]++;
if(board[7][0] == PLAYER && board[4][0] == PLAYER
&& board[5][0] != PLAYER && board[6][0] != PLAYER) ret_ndx[33]++;
if(board[7][7] == PLAYER && board[7][4] == PLAYER
&& board[7][5] != PLAYER && board[7][6] != PLAYER) ret_ndx[33]++;
if(board[7][7] == PLAYER && board[4][7] == PLAYER
&& board[5][7] != PLAYER && board[6][7] != PLAYER) ret_ndx[33]++;
/**********************************************/
if(board[1][1] == PLAYER && board[0][0] == EMPTY) ret_ndx[35]++;
if(board[1][6] == PLAYER && board[0][7] == EMPTY) ret_ndx[35]++;
if(board[6][1] == PLAYER && board[7][0] == EMPTY) ret_ndx[35]++;
if(board[6][6] == PLAYER && board[7][7] == EMPTY) ret_ndx[35]++;
/**********************************************/
if(board[0][0] == EMPTY && board[0][1] == PLAYER) ret_ndx[36]++;
if(board[0][0] == EMPTY && board[1][0] == PLAYER) ret_ndx[36]++;
if(board[0][7] == EMPTY && board[0][6] == PLAYER) ret_ndx[36]++;
if(board[0][7] == EMPTY && board[1][7] == PLAYER) ret_ndx[36]++;
if(board[7][0] == EMPTY && board[6][0] == PLAYER) ret_ndx[36]++;
if(board[7][0] == EMPTY && board[7][1] == PLAYER) ret_ndx[36]++;
if(board[7][7] == EMPTY && board[6][7] == PLAYER) ret_ndx[36]++;
if(board[7][7] == EMPTY && board[7][6] == PLAYER) ret_ndx[36]++;
/********************************************/
if(board[0][1] == PLAYER && board[0][3] == PLAYER
&& board[0][2] == EMPTY) ret_ndx[37]++;
if(board[1][0] == PLAYER && board[3][0] == PLAYER
&& board[2][0] == EMPTY) ret_ndx[37]++;
if(board[0][6] == PLAYER && board[0][4] == PLAYER
&& board[0][5] == EMPTY) ret_ndx[37]++;
if(board[1][7] == PLAYER && board[3][7] == PLAYER
&& board[2][7] == EMPTY) ret_ndx[37]++;
if(board[7][1] == PLAYER && board[7][3] == PLAYER
&& board[7][2] == EMPTY) ret_ndx[37]++;
if(board[6][0] == PLAYER && board[4][0] == PLAYER
&& board[5][0] == EMPTY) ret_ndx[37]++;
if(board[7][6] == PLAYER && board[7][4] == PLAYER
&& board[7][5] == EMPTY) ret_ndx[37]++;
if(board[6][7] == PLAYER && board[4][7] == PLAYER
&& board[5][7] == EMPTY) ret_ndx[37]++;
/**********************************************/
if(board[0][2] == PLAYER && board[0][3] == PLAYER) ret_ndx[38]++;
if(board[2][0] == PLAYER && board[3][0] == PLAYER) ret_ndx[38]++;
if(board[0][5] == PLAYER && board[0][4] == PLAYER) ret_ndx[38]++;
if(board[2][7] == PLAYER && board[3][7] == PLAYER) ret_ndx[38]++;
if(board[7][2] == PLAYER && board[7][3] == PLAYER) ret_ndx[38]++;
if(board[5][0] == PLAYER && board[4][0] == PLAYER) ret_ndx[38]++;
if(board[7][5] == PLAYER && board[7][4] == PLAYER) ret_ndx[38]++;
if(board[5][7] == PLAYER && board[4][7] == PLAYER) ret_ndx[38]++;
/**********************************************/
for(i = 0; i < 8; i++)
{
if(is_legal(board,PLAYER,0,i)) ret_ndx[39]++;
if(is_legal(board,PLAYER,i,0)) ret_ndx[39]++;
if(is_legal(board,PLAYER,7,i)) ret_ndx[39]++;
if(is_legal(board,PLAYER,i,7)) ret_ndx[39]++;
}
/**********************************************/
for(i = 1; i < 7; i++)
for(j = 0; j < 7; j++)
if(is_legal(board,PLAYER,i,j)) ret_ndx[40]++;
/**********************************************/
pos_score = 0;
for(i = 1; i <= MAX_FACTOR; i++)
pos_score += (ret_ndx[i] * weight[i]);
return pos_score;
}
perm_pieces(board,who)
BOARD board;
short who;
{
int i,j;
BOARD temp_board;
int perm = 0;
for(i = 0; i < 8; i++)
for(j = 0; j < 8; j++)
temp_board[i][j] = EMPTY;
for(i = 0; i < 8; i++)
for(j = 0; j < 8; j++)
if(board[i][j] == who)
if(check_perm(board,who,i,j,temp_board) == who)
perm++;
return perm;
}
int check_perm(board,who,i,j,temp_board)
BOARD board, temp_board;
int i,j;
short who;
{
if(board[i][j] != who) return EMPTY;
if(temp_board[i][j] != EMPTY) return temp_board[i][j];
if((i == 0 || i == 7) && (j == 0 || j == 7))
{
temp_board[i][j] = who;
return who;
}
temp_board[i][j] = other(who);
if(i > 0 && i < 7)
if(check_perm(board,who,i+1,j,temp_board) != who)
if(check_perm(board,who,i-1,j,temp_board) != who)
{
temp_board[i][j] = EMPTY;
return EMPTY;
}
if(j > 0 && j < 7)
if(check_perm(board,who,i,j+1,temp_board) != who)
if(check_perm(board,who,i,j-1,temp_board) != who)
{
temp_board[i][j] = EMPTY;
return EMPTY;
}
if((j>0 && j < 7) && (i > 0 && i < 7))
{
if(check_perm(board,who,i+1,j+1,temp_board) != who)
if(check_perm(board,who,i-1,j-1,temp_board) != who)
{
temp_board[i][j] = EMPTY;
return EMPTY;
}
if(check_perm(board,who,i+1,j-1,temp_board) != who)
if(check_perm(board,who,i-1,j+1,temp_board) != who)
{
temp_board[i][j] = EMPTY;
return EMPTY;
}
}
temp_board[i][j] = who;
return who;
}
init_weights(wgt,wgtfile)
int wgt[MAX_FACTOR+1];
char *wgtfile;
{
FILE *fp;
int i;
fp = fopen(wgtfile,"r");
for(i = 1; i <= MAX_FACTOR; i++)
fscanf(fp,"%d",&wgt[i]);
#ifdef DISPLAY_FACTORS
print_factors(wgt,0);
getch();
#endif
}
#ifdef DISPLAY_FACTORS
print_factors(ret_ndx, scr)
int *ret_ndx,scr;
{
int i;
char junk_str[20];
for(i = 1; i <= MAX_FACTOR;i++)
{
if(i > (MAX_FACTOR /2))
gotoxy(3+i - MAX_FACTOR / 2,11);
else
gotoxy(3+i,1);
putch('[');
putstr(itoa(i,junk_str,10));
putch(']');
putch(' ');
putstr(itoa(ret_ndx[i],junk_str,10));
putchar(' '); /* In case a double-digit # was there before */
}
gotoxy(24,5);
putstr("Score: ");
putstr(itoa(scr,junk_str,10));
}
#endif
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/