#include #include #include #define TW 8 /* board side length */ #define NKMAX 64 #define UNKNOWN -1 #define BUFSIZE 256 #define INFILE "CAMELOT.IN" #define OUTFILE "CAMELOT.OUT" #define DEBUG typedef int Board[TW][TW]; /* The type of cost matrices */ static int NK; static int IP[NKMAX*2]; /* input positions */ static Board MCM[NKMAX]; /* cost matrices of matings */ static Board KnightCostMat[TW][TW]; /* all-pos knight costs */ static Board KingMat; #define TW2 (2*TW) #define CL(c) (int)(c-'A') /* chess letter */ #define CD(c) (int)(c-'1') /* chess digit */ void Erase(Board t) { int h,v; for(h=0;h=0 && h=0 && v=0 && h=0 && v