FileDocCategorySizeDatePackage
Boardsquares.javaAPI DocExample2618Sat Sep 12 03:01:00 BST 1998borland.samples.apps.chess.client.board

Boardsquares

public class Boardsquares extends Object

Fields Summary
int[]
board
Constructors Summary
Methods Summary
public synchronized voidadd(borland.samples.apps.chess.client.board.Boardsquares b)

    int column,row;
    for (column=0;column<8;column++){
      for (row=0;row<8;row++) {
        board[column][row] =  board  [column][row] +
        		      b.board[column][row];
      }
    }
  
public synchronized voidassign(int column, int row, int value)


        
    board[column][row] = value;
  
public booleanequals(borland.samples.apps.chess.client.board.Boardsquares b)

    int column,row;
    for (column=0;column<8;column++) {
      for (row=0;row<8;row++) {
      	if (board[column][row] !=  b.board  [column][row])
       	    return false;
      }
    }
    return true;
  
public synchronized voidinit(borland.samples.apps.chess.client.board.Boardsquares b)

    for (int column=0;column<8;column++) {
      for (int row=0;row<8;row++) {
        board[column][row] = b.board[column][row];
      }
    }
  
public intnonZeroElementCount()

    int count = 0;
    for (int column=0;column<8;column++) {
      for (int row=0;row<8;row++) {
      	if (board[column][row] !=  0)
       	    count++;
      }
    }
    return count;
  
public synchronized voidsubtract(borland.samples.apps.chess.client.board.Boardsquares b)

    int column,row;
    for (column=0;column<8;column++) {
      for (row=0;row<8;row++)	{
        board[column][row] = board[column][row] -
                             b.board[column][row];
      }
    }
  
public synchronized intvalue(int file, int rank)

    if (file < 0 || rank < 0 || file > 7 || rank > 7)
     return 0  ;
   else
     return board[file][rank];