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[] = "@(#)allow.c	5.1 (Berkeley) 5/29/85";
   9: #endif not lint
  10: 
  11: #include "back.h"
  12: 
  13: movallow ()  {
  14: 
  15:     register int    i, m, iold;
  16:     int     r;
  17: 
  18:     if (d0)
  19:         swap;
  20:     m = (D0 == D1? 4: 2);
  21:     for (i = 0; i < 4; i++)
  22:         p[i] = bar;
  23:     i = iold = 0;
  24:     while (i < m)  {
  25:         if (*offptr == 15)
  26:             break;
  27:         h[i] = 0;
  28:         if (board[bar])  {
  29:             if (i == 1 || m == 4)
  30:                 g[i] = bar+cturn*D1;
  31:             else
  32:                 g[i] = bar+cturn*D0;
  33:             if (r = makmove(i))  {
  34:                 if (d0 || m == 4)
  35:                     break;
  36:                 swap;
  37:                 movback (i);
  38:                 if (i > iold)
  39:                     iold = i;
  40:                 for (i = 0; i < 4; i++)
  41:                     p[i] = bar;
  42:                 i = 0;
  43:             } else
  44:                 i++;
  45:             continue;
  46:         }
  47:         if ((p[i] += cturn) == home)  {
  48:             if (i > iold)
  49:                 iold = i;
  50:             if (m == 2 && i)  {
  51:                 movback(i);
  52:                 p[i--] = bar;
  53:                 if (p[i] != bar)
  54:                     continue;
  55:                 else
  56:                     break;
  57:             }
  58:             if (d0 || m == 4)
  59:                 break;
  60:             swap;
  61:             movback (i);
  62:             for (i = 0; i < 4; i++)
  63:                 p[i] = bar;
  64:             i = 0;
  65:             continue;
  66:         }
  67:         if (i == 1 || m == 4)
  68:             g[i] = p[i]+cturn*D1;
  69:         else
  70:             g[i] = p[i]+cturn*D0;
  71:         if (g[i]*cturn > home)  {
  72:             if (*offptr >= 0)
  73:                 g[i] = home;
  74:             else
  75:                 continue;
  76:         }
  77:         if (board[p[i]]*cturn > 0 && (r = makmove(i)) == 0)
  78:             i++;
  79:     }
  80:     movback (i);
  81:     return (iold > i? iold: i);
  82: }

Defined functions

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-05-29
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2391
Valid CSS Valid XHTML 1.0 Strict