Im making an battleship game in processing 4 can you check my code and maybe include more features to help me improve it?

1st tab:
Player2 win;
int [] b = {0, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 475, 500};
/* values:
 -2 player2's ship shot.
 -1 means player2's ships
 0  you don't know what is in that cell.
 1 means player1's ship,
 2 player1's ship shot.
 3 is ??
 */
int count=0;
int [][] grid = new int [20][20];
int lcx, lcy;
boolean gameWin, placedships;
int ships1 = 0, totalship1=10;
int ships2 = 0, totalship2=10;
int turn = 1;

void setup() {
  background(250);
  size(500, 500);
  drawgrid();
  win = new Player2();
}


void draw() {
  if (key == ENTER && turn==1) {
    turn=2;
  }
  if (key == 'p' && keyPressed) {
    printt();
  }
}


void mousePressed() {
  if (mouseButton == LEFT && turn==1) {
    for (int r=0; r<20; r++) {
      for (int c=0; c<20; c++) {
        if (mouseX>b[r] && mouseX<b[r+1] && mouseY>b[c] && mouseY<b[c+1] && ships1<10 && grid[r][c]!=1 && grid[r][c]!=2) {
          fill(50, 50, 100);
          ships1++;
          square(b[r], b[c], 25);
          grid[r][c]=1;
        }
      }
    }
  }
  if (mouseButton == RIGHT && turn==1) {
    for (int r=0; r<20; r++) {
      for (int c=0; c<20; c++) {
        if (mouseX>b[r] && mouseX<b[r+1] && mouseY>b[c] && mouseY<b[c+1] && ships2<10 && grid[r][c]!=1 && grid[r][c]!=2) {
          if (grid[r][c]==-1) {
            grid[r][c]=-2;
            ships2--;
            fill(50, 100, 50);
            square(b[r]+7.5, b[c]+7.5, 10);
          }
        }
      }
    }
  }
}


void grabshots() {
  for (int r=0; r<20; r++) {
    for (int c=0; c<20; c++) {
      if (grid[r][c]==2) {
        fill(200, 0, 0);
        square(b[r]+7.5, b[c]+7.5, 10);
        fill(100);
      }
    }
  }
}

void drawgrid() {
  for (int r=0; r<525; r+=25) {
    for (int c=0; c<500; c+=25) {
      fill(100);
      square(r, c, 25);
    }
  }
  fill(25);
}

void printt() {
  println();
  print("player"+ turn + " board");
  println();
  for (int r=0; r<20; r++) {
    for (int c=0; c<20; c++) {
      print(grid[c][r] + ", ");
    }
    println();
  }
}
/*
treat the second tab as a separate processing sketch.
 Declare variables in the main tab and
 you can use them in both the main and second window.
 */

2nd Tab:
class Player2 extends PApplet {

  Player2() {
    super();
    PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
  }
  void settings() {
    size(500, 500);
  }
  void setup() {
    drawgrid();
    botdrawship();
  }

  void draw() {
    if (turn==2) {
      grablocation();
      //    shoot();
      turn=1;
    }
  }
  void shoot() {
    int r = round(random(1, 18));
    int c = round(random(1, 18));
    if (grid[r][c]==1) {
      grid[r][c]=2;
      totalship1--;
      fill(200, 0, 0);
      square(b[r]+7.5, b[c]+7.5, 10);
      fill(100);
    }
    turn=1;
  }
  void botdrawship() {
    count=0;
    while (count<10) {
      int r = round(random(1, 18));
      int c = round(random(1, 18));
      grid[r][c]=-1;
      fill(100, 50, 50);
      square(b[r], b[c], 25);
      count++;
    }
  }
  void grablocation() {
    for (int r=0; r<20; r++) {
      for (int c=0; c<20; c++) {
        if (grid[r][c]==1) {
          fill(50, 50, 100);
          square(b[r], b[c], 25);
        }
      }
    }
  }
  void drawgrid() {
    for (int r=0; r<525; r+=25) {
      for (int c=0; c<500; c+=25) {
        fill(100);
        square(r, c, 25);
      }
    }
    fill(25);
  }
}