Program: 83632
Project: 83632
Buggy source:
public void play(int my_id) throws IOException, ClassNotFoundException {
  Socket sock=new Socket("String_Node_Str",Player.getSocketNumber(thePlayer));
  ObjectOutputStream out=new ObjectOutputStream(sock.getOutputStream());
  ObjectInputStream in=new ObjectInputStream(sock.getInputStream());
  BufferedReader sysin=new BufferedReader(new InputStreamReader(System.in));
  Weights weights=new Weights("String_Node_Str");
  player_id=my_id;
  Rules gameRules=(Rules)in.readObject();
  System.out.printf("String_Node_Str",gameRules.numRows,gameRules.numCols,gameRules.numConnect);
  internal_board=new int[gameRules.numRows][gameRules.numCols];
  for (int r=0; r < gameRules.numRows; r++)   for (int c=0; c < gameRules.numCols; c++)   internal_board[r][c]=0;
  System.out.println("String_Node_Str");
  GameMessage mess=(GameMessage)in.readObject();
  double Qsa=-1;
  boolean beginning=true;
  int move=0;
  int selected_column=0;
  while (mess.win == Player.EMPTY) {
    if (mess.move != -1) {
      int r=0;
      for (r=0; r < gameRules.numRows; r++) {
        if (internal_board[r][mess.move] != 0) {
          internal_board[r - 1][mess.move]=player_id % 2 + 1;
          break;
        }
      }
      if (r == gameRules.numRows)       internal_board[r - 1][mess.move]=player_id % 2 + 1;
    }
 else {
      mess.move=(int)((float)gameRules.numCols * Math.random());
      out.writeObject(mess);
      mess=(GameMessage)in.readObject();
      internal_board[gameRules.numRows - 1][mess.move]=player_id;
      continue;
    }
    if (beginning == false) {
      System.out.println("String_Node_Str" + Qsa + "String_Node_Str"+ player_id);
      sarsa(0,weights,Qsa,internal_board,gameRules,player_id);
    }
    FeatureExplorer[] ff=new FeatureExplorer[gameRules.numCols];
    boolean[] ff_use=new boolean[gameRules.numCols];
    int numFeatures=FeatureExplorer.getNumFeatures();
    double[][] features=new double[gameRules.numCols][numFeatures];
    double[] wx=new double[gameRules.numCols];
    double[] sig=new double[gameRules.numCols];
    double[] w=weights.getWeights();
    double max=0;
    int action=0;
    double temp;
    for (int x=0; x < gameRules.numCols; x++) {
      ff[x]=new FeatureExplorer();
      ff_use[x]=ff[x].initialize(internal_board,gameRules.numRows,gameRules.numCols,x,player_id);
      if (ff_use[x])       features[x]=ff[x].getFeatures();
      for (int y=0; y < numFeatures; y++) {
        if (ff_use[x]) {
          wx[x]+=((double)features[x][y]) * w[y];
        }
 else         wx[x]=0;
      }
      if (ff_use[x])       sig[x]=sigmoid(wx[x]);
 else       sig[x]=0;
      if (x == 0) {
        max=sig[0];
        action=0;
      }
 else       if (sig[x] > max) {
        action=x;
        max=sig[x];
      }
    }
    Qsa=max;
    double epsilon=0.1;
    if (Math.random() < epsilon)     selected_column=action;
 else     selected_column=(int)(Math.random() * gameRules.numCols);
    int r=0;
    for (r=0; r < gameRules.numRows; r++) {
      if (internal_board[r][selected_column] != 0) {
        internal_board[r - 1][selected_column]=player_id;
        break;
      }
    }
    if (r == gameRules.numRows)     internal_board[r - 1][selected_column]=player_id;
    mess.move=selected_column;
    out.writeObject(mess);
    mess=(GameMessage)in.readObject();
    beginning=false;
  }
  System.out.println("String_Node_Str" + Qsa + "String_Node_Str"+ player_id);
  if ((mess.win).equals(thePlayer))   sarsa(1,weights,Qsa,internal_board,gameRules,player_id);
 else   sarsa(0,weights,Qsa,internal_board,gameRules,player_id);
  weights.saveWeights();
  sock.close();
}

Fixed version (ground truth):
public void play(int my_id) throws IOException, ClassNotFoundException {
  Socket sock=new Socket("String_Node_Str",Player.getSocketNumber(thePlayer));
  ObjectOutputStream out=new ObjectOutputStream(sock.getOutputStream());
  ObjectInputStream in=new ObjectInputStream(sock.getInputStream());
  BufferedReader sysin=new BufferedReader(new InputStreamReader(System.in));
  Weights weights=new Weights("String_Node_Str");
  player_id=my_id;
  Rules gameRules=(Rules)in.readObject();
  System.out.printf("String_Node_Str",gameRules.numRows,gameRules.numCols,gameRules.numConnect);
  internal_board=new int[gameRules.numRows][gameRules.numCols];
  for (int r=0; r < gameRules.numRows; r++)   for (int c=0; c < gameRules.numCols; c++)   internal_board[r][c]=0;
  System.out.println("String_Node_Str");
  GameMessage mess=(GameMessage)in.readObject();
  double Qsa=-1;
  boolean beginning=true;
  int move=0;
  int selected_column=0;
  while (mess.win == Player.EMPTY) {
    if (mess.move != -1) {
      int r=0;
      for (r=0; r < gameRules.numRows; r++) {
        if (internal_board[r][mess.move] != 0) {
          internal_board[r - 1][mess.move]=player_id % 2 + 1;
          break;
        }
      }
      if (r == gameRules.numRows)       internal_board[r - 1][mess.move]=player_id % 2 + 1;
    }
 else {
      mess.move=(int)((float)gameRules.numCols * Math.random());
      out.writeObject(mess);
      mess=(GameMessage)in.readObject();
      internal_board[gameRules.numRows - 1][mess.move]=player_id;
      continue;
    }
    if (beginning == false) {
      System.out.println("String_Node_Str" + Qsa + "String_Node_Str"+ player_id);
      sarsa(0,weights,Qsa,internal_board,gameRules,player_id);
    }
    FeatureExplorer[] ff=new FeatureExplorer[gameRules.numCols];
    boolean[] ff_use=new boolean[gameRules.numCols];
    int numFeatures=FeatureExplorer.getNumFeatures();
    double[][] features=new double[gameRules.numCols][numFeatures];
    double[] wx=new double[gameRules.numCols];
    double[] sig=new double[gameRules.numCols];
    double[] w=weights.getWeights();
    double max=0;
    int action=0;
    double temp;
    for (int x=0; x < gameRules.numCols; x++) {
      ff[x]=new FeatureExplorer();
      ff_use[x]=ff[x].initialize(internal_board,gameRules.numRows,gameRules.numCols,x,player_id);
      if (ff_use[x])       features[x]=ff[x].getFeatures();
      for (int y=0; y < numFeatures; y++) {
        if (ff_use[x]) {
          wx[x]+=((double)features[x][y]) * w[y];
        }
 else         wx[x]=0;
      }
      if (ff_use[x])       sig[x]=sigmoid(wx[x]);
 else       sig[x]=0;
      System.out.printf("String_Node_Str",x,wx[x],x,sig[x]);
      if (x == 0) {
        max=sig[0];
        action=0;
      }
 else       if (sig[x] > max) {
        action=x;
        max=sig[x];
      }
    }
    Qsa=max;
    double epsilon=0.1;
    if (Math.random() < epsilon)     selected_column=action;
 else     selected_column=(int)(Math.random() * gameRules.numCols);
    int r=0;
    for (r=0; r < gameRules.numRows; r++) {
      if (internal_board[r][selected_column] != 0) {
        internal_board[r - 1][selected_column]=player_id;
        break;
      }
    }
    if (r == gameRules.numRows)     internal_board[r - 1][selected_column]=player_id;
    mess.move=selected_column;
    out.writeObject(mess);
    mess=(GameMessage)in.readObject();
    beginning=false;
  }
  System.out.println("String_Node_Str" + Qsa + "String_Node_Str"+ player_id);
  if ((mess.win).equals(thePlayer))   sarsa(1,weights,Qsa,internal_board,gameRules,player_id);
 else   sarsa(0,weights,Qsa,internal_board,gameRules,player_id);
  weights.saveWeights();
  sock.close();
}