1: #include "old.h"
   2: 
   3: wplay()
   4: {
   5:     int v1, v2, *p1, *p2, *p3, ab;
   6: 
   7:     if(value < ivalue)
   8:         ivalue = value;
   9:     ab = 0;
  10:     v1 = 3000;
  11:     ply = 0;
  12:     p1 = (int *) statl();
  13:     if(lmp == p1+2) {
  14:         abmove = p1[1];
  15:         lmp = p1;
  16:         return(ivalue);
  17:     }
  18:     p2 = p1;
  19:     mantom = !mantom;
  20:     while(p2 != lmp) {
  21:         p2++;
  22:         wmove(*p2);
  23:         if(testf) {
  24:             mantom = !mantom;
  25:             wstatic(1);
  26:             mantom = !mantom;
  27:         }
  28:         if(rept())
  29:             v2 = 0; else
  30:             v2 = bplay1(v1);
  31:         if(v2 < v1 && !mate(3, 0)) {
  32:             ab = *p2;
  33:             v1 = v2;
  34:         }
  35:         wremove();
  36:         if(testf) {
  37:             mantom = !mantom;
  38:             printf("%6d ", v2);
  39:             out(*p2);
  40:             printf("\n");
  41:             mantom = !mantom;
  42:         }
  43:         p2++;
  44:     }
  45:     if(ab == 0 && lmp != p1)
  46:         ab = p1[1];
  47:     mantom = !mantom;
  48:     lmp = p1;
  49:     abmove = ab;
  50:     return(v1);
  51: }
  52: 
  53: wplay1(ab)
  54: int ab;
  55: {
  56:     int v1, v2, *p1, *p2;
  57: 
  58:     if(ply >= depth)
  59:         return(wquies(ab));
  60:     ply++;
  61:     p1 = p2 = lmp;
  62:     wgen();
  63:     qsort(p1, lmp);
  64:     v1 = 3000;
  65:     while(p2 != lmp) {
  66:         if(intrp)
  67:             goto out;
  68:         p2++;
  69:         wmove(*p2);
  70:         if(battack(wkpos)) {
  71:             v2 = bplay1(v1);
  72:             if(v2 < v1)
  73:                 v1 = v2;
  74:         }
  75:         wremove();
  76:         if(v1 <= ab)
  77:             goto out;
  78:         p2++;
  79:     }
  80: out:
  81:     ply--;
  82:     lmp = p1;
  83:     if(v1 == 3000) {
  84:         v1--;
  85:         if(!check())
  86:             v1 = 0;
  87:     }
  88:     return(v1);
  89: }
  90: 
  91: wquies(ab)
  92: int ab;
  93: {
  94:     int *p1, *p2, *p3, v1, v2;
  95: 
  96:     if(ply >= qdepth)
  97:         return(ivalue);
  98:     p1 = p2 = p3 = lmp;
  99:     wgen();
 100:     while(p2 != lmp) {
 101:         v1 = *p2++;
 102:         if(v1 != value && v1 <= ivalue+50) {
 103:             *p3++ = (((pval+6)[board[*p2>>8]]/100)<<8) |
 104:                 (-(pval+6)[board[*p2&0377]]/100);
 105:             *p3++ = *p2;
 106:         }
 107:         p2++;
 108:     }
 109:     if(p3 == p1) {
 110:         lmp = p1;
 111:         return(value);
 112:     }
 113:     ply++;
 114:     qsort(p1, p3);
 115:     lmp = p3;
 116:     p2 = p1;
 117:     v1 = value;
 118:     while(p2 != lmp) {
 119:         p2++;
 120:         wmove(*p2);
 121:         if(battack(wkpos)) {
 122:             v2 = bquies(v1);
 123:         } else
 124:             v2 = 3000;
 125:         if(v2 < v1)
 126:             v1 = v2;
 127:         wremove();
 128:         if(v1 <= ab)
 129:             goto out;
 130:         p2++;
 131:     }
 132: out:
 133:     ply--;
 134:     lmp = p1;
 135:     return(v1);
 136: }

Defined functions

wplay defined in line 3; used 1 times
wplay1 defined in line 53; used 2 times
wquies defined in line 91; used 2 times
Last modified: 1993-01-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2847
Valid CSS Valid XHTML 1.0 Strict