1: #include "old.h"
   2: 
   3: main()
   4: {
   5:     int i;
   6: 
   7:     printf("Chess\n");
   8:     itinit();
   9:     lmp = lmbuf;
  10:     amp = ambuf;
  11:     *amp++ = -1;
  12:     *lmp++ = -1;        /* fence */
  13:     bookf = open(BOOK, 0);
  14:     if(bookf > 0)
  15:         read(bookf, &bookp, 2);
  16:     i = 64;
  17:     while(i--)
  18:         dir[i] = (edge[i/8]<<6) | edge[i%8];
  19:     play(0);
  20: }
  21: 
  22: ctime(s, t)
  23: {
  24: 
  25:     printf("%s: %d:%d%d\n", s, t/60, (t/10)%6, t%10);
  26: }
  27: 
  28: check()
  29: {
  30: 
  31:     return((!wattack(bkpos) || !battack(wkpos))? 1: 0);
  32: }
  33: 
  34: increm()
  35: {
  36: 
  37:     clktim[mantom] += clock();
  38:     if(mantom)
  39:         moveno++;
  40:     mantom = !mantom;
  41: }
  42: 
  43: decrem()
  44: {
  45: 
  46:     mantom = !mantom;
  47:     if(mantom)
  48:         moveno--;
  49: }
  50: 
  51: stage()
  52: {
  53:     int i, a;
  54: 
  55:     qdepth = depth+8;
  56:     for(i=0; i<13; i++)
  57:         pval[i] = ipval[i];
  58:     value = 0;
  59:     for(i=0; i<64; i++) {
  60:         a = board[i];
  61:         value += (pval+6)[a];
  62:     }
  63:     if(value > 150)
  64:         gval = 1; else
  65:     if(value < -150)
  66:         gval = -1; else
  67:         gval = 0;
  68:     i = -6;
  69:     while(i <= 6) {
  70:         a = (pval+6)[i];
  71:         if(a < 0)
  72:             a -= 50; else
  73:             a += 50;
  74:         if(a < 0)
  75:             a = -((-a)/100); else
  76:             a /= 100;
  77:         if(i)
  78:             (pval+6)[i] = a*100-gval;
  79:         i++;
  80:     }
  81:     a = 13800;
  82:     i = 64;
  83:     while(i--)
  84:         a -= abs((pval+6)[board[i]]);
  85:     if(a > 4000)
  86:         game = 3; else
  87:     if(a > 2000)
  88:         game = 2; else
  89:     if(moveno > 5)
  90:         game = 1; else
  91:         game = 0;
  92: }
  93: 
  94: posit(f, p, a)
  95: int (*f)();
  96: int *p;
  97: {
  98:     int m;
  99: 
 100:     while(amp != p) {
 101:         m = amp[3]<<8;
 102:         m |= amp[4]&0377;
 103:         (*f)(m, a);
 104:         if(mantom) {
 105:             bmove(m);
 106:             moveno++;
 107:             mantom = 0;
 108:         } else {
 109:             wmove(m);
 110:             mantom = 1;
 111:         }
 112:     }
 113: }
 114: 
 115: rept1(m, a)
 116: int *a;
 117: {
 118:     int i;
 119: 
 120:     if(mantom != a[64])
 121:         return;
 122:     for(i=0; i<64; i++)
 123:         if(board[i] != a[i])
 124:             return;
 125:     a[65]++;
 126: }
 127: 
 128: rept()
 129: {
 130:     int a[66], i, *p;
 131: 
 132:     for(i=0; i<64; i++)
 133:         a[i] = board[i];
 134:     a[64] = mantom;
 135:     a[65] = 0;
 136:     p = amp;
 137:     while(amp[-1] != -1) {
 138:         if(amp[-2])
 139:             break;
 140:         i = board[amp[-3]];
 141:         if(i == 1 || i == -1)
 142:             break;
 143:         mantom? wremove(): bremove();
 144:         decrem();
 145:     }
 146:     posit(rept1, p, a);
 147:     return(a[65]);
 148: }

Defined functions

ctime defined in line 22; used 2 times
decrem defined in line 43; used 7 times
increm defined in line 34; used 1 times
main defined in line 3; never used
rept1 defined in line 115; used 1 times
stage defined in line 51; used 3 times
Last modified: 1987-08-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2881
Valid CSS Valid XHTML 1.0 Strict