Esempio n. 1
0
 public Boolean checkcheck(Board x, King c)
 {
     int p = 100;
     int q = 40;
     Point [] checkpossibs = new Point [500];
     x.a = 0;
     /*Checks whether the king is in check, by checking all of the oppossing
      * player's moves and seeing whether they can eat the king*/
      for (int i = 0; i < 8; i++)
     {
         for (int j = 0; j < 8; j++)
         {
             x.piecelocate(p, q);
             if (board[x.numx, x.numy] != 0)
             {
                 checkpossibs = x.findpeice(x.Grid[x.numx, x.numy], x);
             }
             q+= 80;
         }
         q = 40;
         p += 80;
     }
         for(int i = 0; i < x.a; i++)
         {
             if (Grid[checkpossibs[i].X, checkpossibs[i].Y].Contains(c.getcoords()))
             {
                 x.a = 0;
                 return true;
             }
         }
         x.a = 0;
         return false;
     
 }