1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char sccsid[] = "@(#)board.c	5.1 (Berkeley) 5/29/85";
   9: #endif not lint
  10: 
  11: #include "back.h"
  12: 
  13: static int  i, j, k;
  14: static char ln[60];
  15: 
  16: wrboard ()  {
  17:     register int    l;
  18:     static char bl[] =
  19:         "|                       |   |                       |\n";
  20:     static char sv[] =
  21:         "|                       |   |                       |    \n";
  22: 
  23:     fixtty (noech);
  24:     clear();
  25: 
  26:     if (tflag)  {
  27:         fboard();
  28:         goto lastline;
  29:     }
  30: 
  31:     writel ("_____________________________________________________\n");
  32:     writel (bl);
  33:     strcpy (ln,bl);
  34:     for (j = 1; j < 50; j += 4) {
  35:         k = j/4+(j > 24? 12: 13);
  36:         ln[j+1] = k%10+'0';
  37:         ln[j] = k/10+'0';
  38:         if (j == 21)
  39:             j += 4;
  40:     }
  41:     writel (ln);
  42:     for (i = 0; i < 5; i++) {
  43:         strcpy (ln,sv);
  44:         for (j = 1; j < 50; j += 4) {
  45:             k = j/4+(j > 24? 12: 13);
  46:             wrbsub ();
  47:             if (j == 21)
  48:                 j += 4;
  49:         }
  50:         if (-board[25] > i)
  51:             ln[26] = 'w';
  52:         if (-board[25] > i+5)
  53:             ln[25] = 'w';
  54:         if (-board[25] > i+10)
  55:             ln[27] = 'w';
  56:         l = 53;
  57:         if (off[1] > i || (off[1] < 0 && off[1]+15 > i))  {
  58:             ln[54] = 'r';
  59:             l = 55;
  60:         }
  61:         if (off[1] > i+5 || (off[1] < 0 && off[1]+15 > i+5))  {
  62:             ln[55] = 'r';
  63:             l = 56;
  64:         }
  65:         if (off[1] > i+10 || (off[1] < 0 && off[1]+15 > i+10))  {
  66:             ln[56] = 'r';
  67:             l = 57;
  68:         }
  69:         ln[l++] = '\n';
  70:         ln[l] = '\0';
  71:         writel (ln);
  72:     }
  73:     strcpy (ln,bl);
  74:     ln[25] = 'B';
  75:     ln[26] = 'A';
  76:     ln[27] = 'R';
  77:     writel (ln);
  78:     strcpy (ln,sv);
  79:     for (i = 4; i > -1; i--) {
  80:         for (j = 1; j < 50; j += 4) {
  81:             k = ((j > 24? 53: 49)-j)/4;
  82:             wrbsub();
  83:             if (j == 21)
  84:                 j += 4;
  85:         }
  86:         if (board[0] > i)
  87:             ln[26] = 'r';
  88:         if (board[0] > i+5)
  89:             ln[25] = 'r';
  90:         if (board[0] > i+10)
  91:             ln[27] = 'r';
  92:         l = 53;
  93:         if (off[0] > i || (off[0] < 0 && off[0]+15 > i))  {
  94:             ln[54] = 'w';
  95:             l = 55;
  96:         }
  97:         if (off[0] > i+5 || (off[0] < 0 && off[0]+15 > i+5))  {
  98:             ln[55] = 'w';
  99:             l = 56;
 100:         }
 101:         if (off[0] > i+10 || (off[0] < 0 && off[0]+15 > i+10))  {
 102:             ln[56] = 'w';
 103:             l = 57;
 104:         }
 105:         ln[l++] = '\n';
 106:         ln[l] = '\0';
 107:         writel (ln);
 108:     }
 109:     strcpy (ln,bl);
 110:     for (j = 1; j < 50; j += 4) {
 111:         k = ((j > 24? 53: 49)-j)/4;
 112:         ln[j+1] = k%10+'0';
 113:         if (k > 9)
 114:             ln[j] = k/10+'0';
 115:         if (j == 21)
 116:             j += 4;
 117:     }
 118:     writel (ln);
 119:     writel ("|_______________________|___|_______________________|\n");
 120: 
 121: lastline:
 122:     gwrite ();
 123:     if (tflag)
 124:         curmove (18,0);
 125:     else  {
 126:         writec ('\n');
 127:         writec ('\n');
 128:     }
 129:     fixtty(raw);
 130: }
 131: 
 132: wrbsub () {
 133:     register int    m;
 134:     register char   d;
 135: 
 136:     if (board[k] > 0)  {
 137:         m = board[k];
 138:         d = 'r';
 139:     } else {
 140:         m = -board[k];
 141:         d = 'w';
 142:     }
 143:     if (m>i)
 144:         ln[j+1] = d;
 145:     if (m>i+5)
 146:         ln[j] = d;
 147:     if (m>i+10)
 148:         ln[j+2] = d;
 149: }

Defined functions

wrbsub defined in line 132; used 2 times

Defined variables

i defined in line 13; used 27 times
j defined in line 13; used 35 times
k defined in line 13; used 12 times
ln defined in line 14; used 36 times
sccsid defined in line 8; never used
Last modified: 1985-05-29
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2936
Valid CSS Valid XHTML 1.0 Strict