private void flipPieces(int x, int y, int[][] board, int player) {
    int opponent;
    if (player == 1) {
      opponent = -1;
    } else {
      opponent = 1;
    }
    if (checkN(x, y, player, opponent, board)) {
      flipN(x, y, player, opponent, board);
    }
    if (checkNW(x, y, player, opponent, board)) {
      flipNW(x, y, player, opponent, board);
    }
    if (checkW(x, y, player, opponent, board)) {
      flipW(x, y, player, opponent, board);
    }
    if (checkSW(x, y, player, opponent, board)) {
      flipSW(x, y, player, opponent, board);
    }
    if (checkS(x, y, player, opponent, board)) {
      flipS(x, y, player, opponent, board);
    }
    if (checkSE(x, y, player, opponent, board)) {
      flipSE(x, y, player, opponent, board);
    }
    if (checkE(x, y, player, opponent, board)) {
      flipE(x, y, player, opponent, board);
    }
    if (checkNE(x, y, player, opponent, board)) {
      flipNE(x, y, player, opponent, board);
    }
    updateScore();
  }