1: #include "old.h"
   2: 
   3: setup()
   4: {
   5:     char bd[64];
   6:     char *p, *ip;
   7:     int i, err, nkng, c;
   8:     int wkp, bkp;
   9: 
  10:     for(p=bd; p<bd+64; )
  11:         *p++ = 0;
  12:     err = 0;
  13:     nkng = 101;
  14:     p = bd;
  15:     for(i=0; i<8; i++) {
  16:         ip = p+8;
  17: 
  18:     loop:
  19:         switch(c = getchar()) {
  20: 
  21:         case 'K':
  22:             nkng -= 100;
  23:             c = 6;
  24:             bkp = p-bd;
  25:             break;
  26: 
  27:         case 'k':
  28:             nkng--;
  29:             c = -6;
  30:             wkp = p-bd;
  31:             break;
  32: 
  33:         case 'P':
  34:             c = 1;
  35:             break;
  36: 
  37:         case 'p':
  38:             c = -1;
  39:             break;
  40: 
  41:         case 'N':
  42:             c = 2;
  43:             break;
  44: 
  45:         case 'n':
  46:             c = -2;
  47:             break;
  48: 
  49:         case 'B':
  50:             c = 3;
  51:             break;
  52: 
  53:         case 'b':
  54:             c = -3;
  55:             break;
  56: 
  57:         case 'R':
  58:             c = 4;
  59:             break;
  60: 
  61:         case 'r':
  62:             c = -4;
  63:             break;
  64: 
  65:         case 'Q':
  66:             c = 5;
  67:             break;
  68: 
  69:         case 'q':
  70:             c = -5;
  71:             break;
  72: 
  73:         case '1':
  74:         case '2':
  75:         case '3':
  76:         case '4':
  77:         case '5':
  78:         case '6':
  79:         case '7':
  80:         case '8':
  81:             p += c-'0';
  82:             goto loop;
  83: 
  84:         case ' ':
  85:             p++;
  86:             goto loop;
  87: 
  88:         case '\n':
  89:             if(p > ip)
  90:                 err++;
  91:             p = ip;
  92:             continue;
  93: 
  94:         default:
  95:             err++;
  96:             if(c <= 0)
  97:                 onhup();
  98:             goto loop;
  99:         }
 100:         if(p < ip)
 101:             *p++ = c;
 102:         goto loop;
 103:     }
 104:     if(nkng)
 105:         err++;
 106:     if(err) {
 107:         printf("Illegal setup\n");
 108:         return;
 109:     }
 110:     for(i=0; i<64; i++)
 111:         board[i] = bd[i];
 112:     amp = ambuf+1;
 113:     lmp = lmbuf+1;
 114:     eppos = 64;
 115:     bookp = 0;
 116:     mantom = 0;
 117:     moveno = 1;
 118:     wkpos = wkp;
 119:     bkpos = bkp;
 120:     flag = 0;
 121:     if(wkpos == 60) {
 122:         if(board[56] == -4)
 123:             flag |= 2;
 124:         if(board[63] == -4)
 125:             flag |= 1;
 126:     }
 127:     if(bkpos == 4) {
 128:         if(board[0] == 4)
 129:             flag |= 020;
 130:         if(board[7] == 4)
 131:             flag |= 010;
 132:     }
 133:     printf("Setup successful\n");
 134: }

Defined functions

setup defined in line 3; used 1 times
Last modified: 1987-08-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2298
Valid CSS Valid XHTML 1.0 Strict