1: #include "old.h"
   2: 
   3: bagen()
   4: {
   5:     int *p1, *p2, v;
   6: 
   7:     p1 = lmp;
   8:     if((flag&010)!=0)
   9:     if(board[5]==0 && board[6]==0 && board[7]==4)
  10:     if(wattack(4) && wattack(5) && wattack(6))
  11:         btry(4, 0, 2); /* kingside castle */
  12:     if((flag&020)!=0)
  13:     if(board[0]==4 && board[1]==0 && board[2]==0 && board[3]==0)
  14:     if(wattack(2) && wattack(3) && wattack(4))
  15:         btry(4, 0, -2); /* queenside castle */
  16:     bgen();
  17:     p2 = p1;
  18:     while(p2 != lmp) {
  19:         v = *p2++;
  20:         bmove(*p2);
  21:         if(wattack(bkpos)) {
  22:             *p1++ = v;
  23:             *p1++ = *p2;
  24:         }
  25:         p2++;
  26:         bremove();
  27:     }
  28:     lmp = p1;
  29: }
  30: 
  31: btry(from, mask, offset)
  32: int from, mask, offset;
  33: {
  34: 
  35:     if((dir[from]&mask)==0)
  36:         bcheck(from, from+offset);
  37: }
  38: 
  39: bcheck(from, to)
  40: int from, to;
  41: {
  42: 
  43:     if(board[to]>0) return(1);
  44:     *lmp++ = (pval+6)[board[to]]-value;
  45:     *lmp++ = (from<<8)|to;
  46:     return(board[to] != 0);
  47: }
  48: 
  49: wagen()
  50: {
  51:     int *p1, *p2, v;
  52: 
  53:     p1 = lmp;
  54:     if((flag&1)!=0)
  55:     if(board[61]==0 && board[62]==0 && board[63]== -4)
  56:     if(battack(60) && battack(61) && battack(62))
  57:         wtry(60, 0, 2); /* kingside castle */
  58:     if((flag&2)!=0)
  59:     if(board[56]== -4 && board[57]==0 && board[58]==0 && board[59]==0)
  60:     if(battack(58) && battack(59) && battack(60))
  61:         wtry(60, 0, -2); /* queenside castle */
  62:     wgen();
  63:     p2 = p1;
  64:     while(p2 != lmp) {
  65:         v = *p2++;
  66:         wmove(*p2);
  67:         if(battack(wkpos)) {
  68:             *p1++ = v;
  69:             *p1++ = *p2;
  70:         }
  71:         p2++;
  72:         wremove();
  73:     }
  74:     lmp = p1;
  75: }
  76: 
  77: wtry(from, mask, offset)
  78: int from, mask, offset;
  79: {
  80: 
  81:     if((dir[from]&mask)==0)
  82:         wcheck(from, from+offset);
  83: }
  84: 
  85: wcheck(from, to)
  86: int from, to;
  87: {
  88: 
  89:     if(board[to]<0) return(1);
  90:     *lmp++ = value-(pval+6)[board[to]];
  91:     *lmp++ = (from<<8)|to;
  92:     return(board[to] != 0);
  93: }

Defined functions

bcheck defined in line 39; used 1 times
  • in line 36
btry defined in line 31; used 2 times
wcheck defined in line 85; used 1 times
  • in line 82
wtry defined in line 77; used 2 times
Last modified: 1979-05-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2426
Valid CSS Valid XHTML 1.0 Strict