home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / SMARTMAG / V2.MSA / XADVISOR.STQ_CHESS.RUL < prev    next >
Text File  |  2003-12-17  |  10KB  |  237 lines

  1. ;***************************************************************************
  2. ;*                                                                         *
  3. ;*  CHESS.RUL XAdvisor Knowledge Base.  Written by Christopher F. Chabris  *
  4. ;*                                                                         *
  5. ;*  START magazine, Fall 1986.      Copyright 1986 by Antic Publishing.    *
  6. ;*                                                                         *
  7. ;***************************************************************************
  8. ;
  9. ; Rules for advising which plan to use in a chess position based
  10. ;  on the position's surface characteristics.  This application has
  11. ;  many repetitive rules that apply to both the "player" and the "opponent"
  12. ;  and could benefit from some sort of added pattern-matching function.
  13. ; Additionally, a set of global constraints could be used to prevent
  14. ;  contradictions from arising and repetitive questions from being asked.
  15.  
  16.  
  17. ; Rules to suggest specific plans:
  18.  
  19. (if (("there is a significant material imbalance"))
  20.     ("cannot make a more concrete recommendation than to analyse further"))
  21. (if (("the position is extremely tactical"))
  22.     ("cannot make a more concrete recommendation than to analyse further"))
  23.  
  24. (if (("player has a decisive material advantage"))
  25.     ("advise trading pieces to reach a won endgame"))
  26.  
  27. (if (("opponent's king is in the center")
  28.      ("one or more center files are open")
  29.      ("player's pieces are more active"))
  30.     ("advise attacking quickly, perhaps sacrificially"))
  31. (if (("opponent's king is in the center")
  32.      ("player has a large development advantage")
  33.      ("player has a concentration of pieces in the center"))
  34.     ("advise attacking quickly, perhaps sacrificially"))
  35. (if (("kings are on opposite sides")
  36.      ("opponent's king is exposed")
  37.      ("center is closed"))
  38.     ("advise attacking deliberately"))
  39. (if (("kings are on the same side")
  40.      ("opponent's king is exposed"))
  41.     ("advise attacking deliberately"))
  42.  
  43. (if (("king safety is not a factor")
  44.      ("player has a positional advantage"))
  45.     ("advise a positional buildup and strategic attack"))
  46. (if (("king safety is not a factor")
  47.      ("opponent has a positional advantage"))
  48.     ("advise defending and waiting for an opportunity to counterattack"))
  49. (if (("player's king is exposed")
  50.      ("opponent's king is safe"))
  51.     ("advise defending carefully, making necessary concessions"))
  52.  
  53. (if (("opponent has a decisive material advantage"))
  54.     ("advise attacking wildly, avoiding exchanges, and praying"))
  55.  
  56.  
  57. ; Rules for determining king safety:
  58. ; [Note that these rules allow the following contradiction: both "player's
  59. ;  king is safe" and "player's king is exposed" can be placed into the
  60. ;  context.  Although it is not clear that this contradiction is entirely
  61. ;  illogical (a king could be exposed but safe nevertheless), it could be
  62. ;  resolved by either rewriting the rules or adding some sort of global
  63. ;  constraints or meta-level rules to prevent it from occuring.]
  64.  
  65. (if (("pawns around player's king are intact")
  66.      ("there are no open files near player's king"))
  67.     ("player's king is safe"))
  68. (if (("pawns around opponent's king are intact")
  69.      ("there are no open files near opponent's king"))
  70.     ("opponent's king is safe"))
  71. (if (("player's king is safe")
  72.      ("opponent's king is safe"))
  73.     ("king safety is not a factor"))
  74. (if (("material is balanced")
  75.      ("queens have been exchanged"))
  76.     ("king safety is not a factor"))
  77.  
  78. ; Rules for determining king-safety factors:
  79. (if (("there are no weak squares around player's king")
  80.      ("player has one or more pieces near the king"))
  81.     ("pawns around player's king are intact"))
  82. (if (("there are weak squares around player's king")
  83.      ("player has a fianchettoed bishop near the king"))
  84.     ("pawns around player's king are intact"))
  85. (if (("there are no weak squares around opponent's king")
  86.      ("opponent has one or more pieces near the king"))
  87.     ("pawns around opponent's king are intact"))
  88. (if (("there are weak squares around opponent's king")
  89.      ("opponent has a fianchettoed bishop near the king"))
  90.     ("pawns around opponent's king are intact"))
  91. (if (("there are weak squares around player's king"))
  92.     ("player's king is exposed"))
  93. (if (("player has no pieces near the king"))
  94.     ("player's king is exposed"))
  95. (if (("there are one or more open files near player's king"))
  96.     ("player's king is exposed"))
  97. (if (("there are weak squares around opponent's king"))
  98.     ("opponent's king is exposed"))
  99. (if (("opponent has no pieces near the king"))
  100.     ("opponent's king is exposed"))
  101. (if (("there are one or more open files near opponent's king"))
  102.     ("opponent's king is exposed"))
  103.  
  104. ; Rules for determining king position:
  105. (if (("player's king is on the kingside")
  106.      ("opponent's king is on the kingside"))
  107.     ("kings are on the same side"))
  108. (if (("player's king is on the queenside")
  109.      ("opponent's king is on the queenside"))
  110.     ("kings are on the same side"))
  111. (if (("player's king is on the kingside")
  112.      ("opponent's king is on the queenside"))
  113.     ("kings are on opposite sides"))
  114. (if (("player's king is on the queenside")
  115.      ("opponent's king is on the kingside"))
  116.     ("kings are on opposite sides"))
  117.  
  118.  
  119. ;Rules for determining piece activity:
  120.  
  121. (if (("player's pieces are farther advanced")
  122.      ("player's pieces attack more squares")
  123.      ("player's pieces have greater mobility"))
  124.     ("player's pieces are more active"))
  125. (if (("opponent's pieces are farther advanced")
  126.      ("opponent's pieces attack more squares")
  127.      ("opponent's pieces have greater mobility"))
  128.     ("opponent's pieces are more active"))
  129.  
  130.  
  131. ;Rules for determining the central configuration:
  132.  
  133. (if (("player has a d-pawn and an e-pawn")
  134.      ("opponent has a d-pawn and an e-pawn")
  135.      ("center pawns cannot safely advance"))
  136.     ("center is closed"))
  137.  
  138.  
  139. ;Rules for determining tactical & positional factors:
  140.  
  141. (if (("one or more pieces is en prise"))
  142.     ("the position is extremely tactical"))
  143. (if (("player is in check"))
  144.     ("the position is extremely tactical"))
  145. (if (("player was in check recently"))
  146.     ("the position is extremely tactical"))
  147. (if (("opponent is in check"))
  148.     ("the position is extremely tactical"))
  149. (if (("opponent was in check recently"))
  150.     ("the position is extremely tactical"))
  151.  
  152. (if (("player has two bishops")
  153.      ("opponent has one or no bishops"))
  154.     ("player has a mobility advantage"))
  155. (if (("opponent has two bishops")
  156.      ("player has one or no bishops"))
  157.     ("opponent has a mobility advantage"))
  158. (if (("position is closed")
  159.      ("player has more knights"))
  160.     ("player has a mobility advantage"))
  161. (if (("position is closed")
  162.      ("opponent has more kinghts"))
  163.     ("opponent has a mobility advantage"))
  164.  
  165. (if (("player has fewer pawn islands")
  166.      ("opponent has one or more isolated pawns"))
  167.     ("player has a structural advantage"))
  168. (if (("player has fewer pawn islands")
  169.      ("opponent has one or more backward pawns"))
  170.     ("player has a structural advantage"))
  171. (if (("player has fewer pawn islands")
  172.      ("opponent has doubled or tripled pawns"))
  173.     ("player has a structural advantage"))
  174. (if (("opponent has fewer pawn islands")
  175.      ("player has one or more isolated pawns"))
  176.     ("opponent has a structural advantage"))
  177. (if (("opponent has fewer pawn islands")
  178.      ("player has one or more backward pawns"))
  179.     ("opponent has a structural advantage"))
  180. (if (("opponent has fewer pawn islands")
  181.      ("player has doubled or tripled pawns"))
  182.     ("opponent has a structural advantage"))
  183.  
  184.  
  185. ; Rules for dynamic advantages:
  186. ; [Note that each side may easily satisfy the conditions for a dynamic
  187. ;  advantage since the rules say nothing about the other player's
  188. ;  position; this is logical since dynamic advantages are not enduring
  189. ;  and often difficult to exploit before they expire.]
  190.  
  191. (if (("player has one or more passed pawns"))
  192.     ("player has a dynamic advantage"))
  193. (if (("player has one or more rooks on the seventh rank"))
  194.     ("player has a dynamic advantage"))
  195. (if (("player controls more open files"))
  196.     ("player has a dynamic advantage"))
  197. (if (("opponent has one or more passed pawns"))
  198.     ("opponent has a dynamic advantage"))
  199. (if (("opponent has one or more rooks on the seventh rank"))
  200.     ("opponent has a dynamic advantage"))
  201. (if (("opponent controls more open files"))
  202.     ("opponent has a dynamic advantage"))
  203.  
  204.  
  205. ; Rules for aggregating positional advantages:
  206. ; [Note: this section of the rules sorely needs a weighting/point-value
  207. ;  assignment system to quantify the relationships between the various
  208. ;  positional advantages.  The following rules are somewhat incomplete
  209. ;  because to make them complete without modification of the production-
  210. ;  system interpreter would require representing all permutations of the
  211. ;  possible advantages for the two sides.  It still works!]
  212.  
  213. (if (("player has a mobility advantage")
  214.      ("player has a structural advantage")
  215.      ("player has a dynamic advantage"))
  216.     ("player has a positional advantage"))
  217. (if (("opponent has a mobility advantage")
  218.      ("opponent has a structural advantage")
  219.      ("opponent has a dynamic advantage"))
  220.     ("opponent has a positional advantage"))
  221. (if (("player has a mobility advantage")
  222.      ("player has a dynamic advantage")
  223.      ("opponent has a structural advantage"))
  224.     ("player has a positional advantage"))
  225. (if (("opponent has a mobility advantage")
  226.      ("opponent has a dynamic advantage")
  227.      ("player has a structural advantage"))
  228.     ("opponent has a positional advantage"))
  229.  
  230.  
  231. ; [Of course, these rules are by no means comprehensive and could go on
  232. ;  and on to more levels of detail and sophistication, culminating in
  233. ;  examinations of exact positions and recommendations of specific move
  234. ;  sequences.  This would be beyond the abilities of ADVISOR, but it has
  235. ;  been done in some computer chess programs.]
  236.  
  237.