%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % KRK illegal problem. This involves deciding whether a chess ending % with White King, White Rook and Black King is illegal % when White is to move. Example positions are defined as % % illegal(WKRank,WKFile,WRRank,WRFile,BKRank,BKFile) % % Thus the following illegal position is defined as follows: % % File % |~~~~~~~~~~~~~~~~| 7 % | WK | 6 % | | 5 % Rank | | 4 = illegal(6,1,3,2,3,7) % | WR BK| 3 % | | 2 % | | 1 % |________________| 0 % 0 1 2 3 4 5 6 7 % Background knowledge - adj(R/C,R/C) adj(0,0). adj(1,1). adj(2,2). adj(3,3). adj(4,4). adj(5,5). adj(6,6). adj(7,7). adj(0,1). adj(1,2). adj(2,3). adj(3,4). adj(4,5). adj(5,6). adj(6,7). adj(7,6). adj(6,5). adj(5,4). adj(4,3). adj(3,2). adj(2,1). adj(1,0). %%%%%%%%%%%%%%%%%% % Positive examples pos(illegal(7,2,5,0,6,1)). pos(illegal(6,1,5,0,6,1)). pos(illegal(6,0,5,0,6,1)). pos(illegal(6,2,5,0,6,1)). pos(illegal(5,1,5,0,6,1)). pos(illegal(5,0,5,0,6,1)). pos(illegal(5,2,5,0,6,1)). pos(illegal(7,1,5,0,6,1)). pos(illegal(7,0,5,0,6,1)). pos(illegal(7,2,5,0,7,2)). pos(illegal(7,2,5,0,7,3)). pos(illegal(7,2,5,0,7,1)). pos(illegal(7,2,5,0,6,2)). pos(illegal(7,2,5,0,6,3)). pos(illegal(5,2,5,2,7,3)). pos(illegal(4,3,5,2,7,2)). pos(illegal(0,1,5,2,5,4)). pos(illegal(1,3,2,4,6,5)). % Negative examples neg(illegal(7,2,5,0,3,4)). neg(illegal(7,2,5,0,4,1)). neg(illegal(7,2,5,0,6,4)). neg(illegal(4,3,5,2,7,3)). neg(illegal(0,1,5,2,6,4)). neg(illegal(1,3,2,4,6,5)).