title: Chess board and piece design in java
body: <p>I'm working on to do my assignment. It is a chess design(AI, GUI not required), I have piece class. The piece class has two variables: color and name. So far I have a "move method" like this in this class.
       `</p>
  
  <pre><code>  public void move(Piece piece,int x,int y)
    {
   int a=0;
   int b=0;
  
    for(int i=0;i&lt;Board.grid.length;i++) {
     for(int r=0;r&lt;Board.grid[i].length;r++) {
     if(Board.grid[i][r]==piece)
     a=i;
     b=r;
     if(Board.getisnull(x, y)){
     Board.grid[a][b]=null;
     Board.grid[x][y]=piece;
     }
    }
   }
  Board.grid[u][t]=null;
  }
  `
  </code></pre>
  
  <p>In this code, I want to find an index which is the old index of the piece I want to move, then moving it then setting its old index to null but this is not working. I can see the name on screen but not the color. Also, old index is not set to null. How to do it? I started to think using an object(piece) array but how?</p>