home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / mapi / checkers.frm / engine / lut.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  6.2 KB  |  216 lines

  1. /* --------------------------------------------------------------------------
  2. RED is on top moving down
  3. BLACK is on bottom moving up
  4. -------------------------------------------------------------------------- */
  5. const int black_lut[][4] =
  6. {
  7.     /* move 1, become king flag, move 2, become king flag */
  8.     { 0,0,0,0 },
  9.     {  1+4, 0    ,  1+5, 0     },
  10.     {  2+4, 0    ,  2+5, 0     },
  11.     {  3+4, 0    ,  3+5, 0     },
  12.     {  4+4, 0    ,  0  , 0     },
  13.     {  5+4, 0    ,  0  , 0     },
  14.     {  6+3, 0    ,  6+4, 0     },
  15.     {  7+3, 0    ,  7+4, 0     },
  16.     {  8+3, 0    ,  8+4, 0     },
  17.     {  9+4, 0    ,  9+5, 0     },
  18.     { 10+4, 0    , 10+5, 0     },
  19.     { 11+4, 0    , 11+5, 0     },
  20.     { 12+4, 0    ,  0  , 0     },
  21.     { 13+4, 0    ,  0  , 0     },
  22.     { 14+3, 0    , 14+4, 0     },
  23.     { 15+3, 0    , 15+4, 0     },
  24.     { 16+3, 0    , 16+4, 0     },
  25.     { 17+4, 0    , 17+5, 0     },
  26.     { 18+4, 0    , 18+5, 0     },
  27.     { 19+4, 0    , 19+5, 0     },
  28.     { 20+4, 0    ,  0  , 0     },
  29.     { 21+4, 0    ,  0  , 0     },
  30.     { 22+3, 0    , 22+4, 0     },
  31.     { 23+3, 0    , 23+4, 0     },
  32.     { 24+3, 0    , 24+4, 0     },
  33.     { 25+4, KING , 25+5, KING  },
  34.     { 26+4, KING , 26+5, KING  },
  35.     { 27+4, KING , 27+5, KING  },
  36.     { 28+4, KING ,  0  , 0     },
  37.     { 0,0,0,0 },
  38.     { 0,0,0,0 },
  39.     { 0,0,0,0 },
  40.     { 0,0,0,0 },
  41.     { 0,0,0,0 },
  42.     { 0,0,0,0 },
  43.     { 0,0,0,0 }
  44. };
  45.  
  46. const int red_lut[][4] =
  47. {
  48.     /* move 1, become king flag, move 2, become king flag */
  49.     { 0,0,0,0 },
  50.     { 0,0,0,0 },
  51.     { 0,0,0,0 },
  52.     { 0,0,0,0 },
  53.     { 0,0,0,0 },
  54.     {  5-4, KING ,  0  , 0     },
  55.     {  6-5, KING ,  6-4, KING  },
  56.     {  7-5, KING ,  7-4, KING  },
  57.     {  8-5, KING ,  8-4, KING  },
  58.     {  9-4, 0    ,  9-3, 0     },
  59.     { 10-4, 0    , 10-3, 0     },
  60.     { 11-4, 0    , 11-3, 0     },
  61.     { 12-4, 0    ,  0  , 0     },
  62.     { 13-4, 0    ,  0  , 0     },
  63.     { 14-5, 0    , 14-4, 0     },
  64.     { 15-5, 0    , 15-4, 0     },
  65.     { 16-5, 0    , 16-4, 0     },
  66.     { 17-4, 0    , 17-3, 0     },
  67.     { 18-4, 0    , 18-3, 0     },
  68.     { 19-4, 0    , 19-3, 0     },
  69.     { 20-4, 0    ,  0  , 0     },
  70.     { 21-4, 0    ,  0  , 0     },
  71.     { 22-5, 0    , 22-4, 0     },
  72.     { 23-5, 0    , 23-4, 0     },
  73.     { 24-5, 0    , 24-4, 0     },
  74.     { 25-4, 0    , 25-3, 0     },
  75.     { 26-4, 0    , 26-3, 0     },
  76.     { 27-4, 0    , 27-3, 0     },
  77.     { 28-4, 0    ,  0  , 0     },
  78.     { 29-4, 0    ,  0  , 0     },
  79.     { 30-5, 0    , 30-4, 0     },
  80.     { 31-5, 0    , 31-4, 0     },
  81.     { 32-5, 0    , 32-4, 0     },
  82.     { 0,0,0,0 },
  83.     { 0,0,0,0 },
  84.     { 0,0,0,0 }
  85. };
  86.  
  87. const int black_jump_lut[][5] =
  88. {
  89.     /* over, onto -or- over, onto , become king flag */
  90.     { 0,0,0,0,0 },
  91.     {  1+5,  1+9,  0  ,  0  ,0},
  92.     {  2+4,  2+7,  2+5,  2+9,0},
  93.     {  3+4,  3+7,  3+5,  3+9,0},
  94.     {  4+4,  4+7,  0  ,  0  ,0},
  95.     {  5+4,  5+9,  0  ,  0  ,0},
  96.     {  6+3,  6+7,  6+4,  6+9,0},
  97.     {  7+3,  7+7,  7+4,  7+9,0},
  98.     {  8+3,  8+7,  0  ,  0  ,0},
  99.     {  9+5,  9+9,  0  ,  0  ,0},
  100.     { 10+4, 10+7, 10+5, 10+9,0},
  101.     { 11+4, 11+7, 11+5, 11+9,0},
  102.     { 12+4, 12+7,  0  ,  0  ,0},
  103.     { 13+4, 13+9,  0  ,  0  ,0},
  104.     { 14+3, 14+7, 14+4, 14+9,0},
  105.     { 15+3, 15+7, 15+4, 15+9,0},
  106.     { 16+3, 16+7,  0  ,  0  ,0},
  107.     { 17+5, 17+9,  0  ,  0  ,0},
  108.     { 18+4, 18+7, 18+5, 18+9,0},
  109.     { 19+4, 19+7, 19+5, 19+9,0},
  110.     { 20+4, 20+7,  0  ,  0  ,0},
  111.     { 21+4, 21+9,  0  ,  0  ,KING},
  112.     { 22+3, 22+7, 22+4, 22+9,KING},
  113.     { 23+3, 23+7, 23+4, 23+9,KING},
  114.     { 24+3, 24+7,  0  ,  0  ,KING},
  115.     { 0,0,0,0,0 },
  116.     { 0,0,0,0,0 },
  117.     { 0,0,0,0,0 },
  118.     { 0,0,0,0,0 },
  119.     { 0,0,0,0,0 },
  120.     { 0,0,0,0,0 },
  121.     { 0,0,0,0,0 },
  122.     { 0,0,0,0,0 },
  123.     { 0,0,0,0,0 },
  124.     { 0,0,0,0,0 },
  125.     { 0,0,0,0,0 }
  126. };
  127.  
  128. const int red_jump_lut[][5] =
  129. {
  130.     /* over, onto -or- over, onto , become king flag */
  131.     { 0,0,0,0,0 },
  132.     { 0,0,0,0,0 },
  133.     { 0,0,0,0,0 },
  134.     { 0,0,0,0,0 },
  135.     { 0,0,0,0,0 },
  136.     { 0,0,0,0,0 },
  137.     { 0,0,0,0,0 },
  138.     { 0,0,0,0,0 },
  139.     { 0,0,0,0,0 },
  140.     {  9-3,  9-7,     0  ,  0  ,KING},
  141.     { 10-4, 10-9,    10-3, 10-7,KING},
  142.     { 11-4, 11-9,    11-3, 11-7,KING},
  143.     { 12-4, 12-9,     0  ,  0  ,KING},
  144.     { 13-4, 13-7,     0  ,  0  ,0},
  145.     { 14-5, 14-9,    14-4, 14-7,0},
  146.     { 15-5, 15-9,    15-4, 15-7,0},
  147.     { 16-5, 16-9,     0  ,  0  ,0},
  148.     { 17-3, 17-7,     0  ,  0  ,0},
  149.     { 18-4, 18-9,    18-3, 18-7,0},
  150.     { 19-4, 19-9,    19-3, 19-7,0},
  151.     { 20-4, 20-9,     0  ,  0  ,0},
  152.     { 21-4, 21-7,     0  ,  0  ,0},
  153.     { 22-5, 22-9,    22-4, 22-7,0},
  154.     { 23-5, 23-9,    23-4, 23-7,0},
  155.     { 24-5, 24-9,     0  ,  0  ,0},
  156.     { 25-3, 25-7,     0  ,  0  ,0},
  157.     { 26-4, 26-9,    26-3, 26-7,0},
  158.     { 27-4, 27-9,    27-3, 27-7,0},
  159.     { 28-4, 28-9,     0  ,  0  ,0},
  160.     { 29-4, 29-7,     0  ,  0  ,0},
  161.     { 30-5, 30-9,    30-4, 30-7,0},
  162.     { 31-5, 31-9,    31-4, 31-7,0},
  163.     { 32-5, 32-9,     0  ,  0  ,0},
  164.     { 0,0,0,0,0 },
  165.     { 0,0,0,0,0 },
  166.     { 0,0,0,0,0 }
  167. };
  168.  
  169. /* --------------------------------------------------------------------------
  170. The following is the order in which the pieces will be tryed
  171. normally, it makes no difference, but if the game tree gets pruned,
  172. the moves at the bottom could be ignored.
  173. -------------------------------------------------------------------------- */
  174. struct _piece_order_struct {SQUARE m; long q;} piece_order[SQRS_MAX] =
  175. {
  176.     /* piece number, best quality achievable by piece */
  177.     {0,  -1}, /* zero move.  it is important to understand that this move
  178.                  need not be tested except when the piece order has been
  179.                  sorted because after the sort, the 0th element could contain
  180.                  a legal move.  Whereas before the sort, it could not */
  181.     {1,  -1},
  182.     {2,  -1},
  183.     {3,  -1},
  184.     {4,  -1},
  185.     {5,  -1},
  186.     {6,  -1},
  187.     {7,  -1},
  188.     {8,  -1},
  189.     {9,  -1},
  190.     {10, -1},
  191.     {11, -1},
  192.     {12, -1},
  193.     {13, -1},
  194.     {14, -1},
  195.     {15, -1},
  196.     {16, -1},
  197.     {17, -1},
  198.     {18, -1},
  199.     {19, -1},
  200.     {20, -1},
  201.     {21, -1},
  202.     {22, -1},
  203.     {23, -1},
  204.     {24, -1},
  205.     {25, -1},
  206.     {26, -1},
  207.     {27, -1},
  208.     {28, -1},
  209.     {29, -1},
  210.     {30, -1},
  211.     {31, -1},
  212.     {32, -1},
  213.     {33, -1},
  214.     {34, -1}
  215. };
  216.