program Camelot; const TW = 8; TW2 = 2*TW; NKMAX = 63; UNKNOWN = -1; INFILE = 'CAMELOT.IN'; OUTFILE = 'CAMELOT.OUT'; type Board = array[0..TW-1,0..TW-1] of integer; BigBoard = array[0..TW2-1,0..TW2-1] of integer; BigString= string[255]; var NK : integer; (* # knights *) IP : array[0..2*NKMAX-1] of integer; (* input *) MCM: array[0..NKMAX-1] of Board; (* cost matrices for matings *) KingMat : Board; KMats : array[0..TW-1,0..TW-1] of Board; (* all-pos knights costs *) KBoard: BigBoard; function CL(c:char):integer; (* chess letter *) begin CL := ord(c) - ord('A'); end; function CD(c:char):integer; (* chess digit *) begin CD := ord(c) - ord('1'); end; procedure Erase(var t:Board); var h,v:integer; begin for h:=0 to TW-1 do for v:=0 to TW-1 do t[h,v] := UNKNOWN; end; procedure AddBoard(a,b: Board; var c:Board); var v,h:integer; begin for v:=0 to TW-1 do for h:=0 to TW-1 do c[h,v] := a[h,v]+b[h,v]; end; procedure KnightCosts(h,v,s:integer; var t:Board); begin if(h>=0) and (h=0) and (v=0) and (h=0) and (v