nus-yam/ex-repair huggingface dataset:
Program: 154197
Project: 154197
Buggy source:
public static void lostPassword(User user,String newPassword){
  Message message=new Message();
  message.setSubject("String_Node_Str" + user.firstName);
  message.setSender("String_Node_Str");
  message.setTo(user.email);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",user);
  params.put("String_Node_Str",newPassword);
  send(message,template,params);
}

Fixed version (ground truth):
public static void lostPassword(User user){
  Message message=new Message();
  message.setSubject(Messages.get("String_Node_Str") + "String_Node_Str" + user.firstName);
  message.setSender("String_Node_Str");
  message.setTo(user.email);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",user);
  send(message,template,params);
}
Program: 154198
Project: 154198
Buggy source:
public static void userBookingConfirmation(Booking booking){
  Message message=new Message();
  message.setSubject("String_Node_Str" + booking.deal.hotelName);
  message.setSender("String_Node_Str");
  message.setTo(booking.user.email);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",booking.user);
  params.put("String_Node_Str",booking);
  send(message,template,params);
}

Fixed version (ground truth):
public static void userBookingConfirmation(Booking booking){
  Message message=new Message();
  message.setSubject(Messages.get("String_Node_Str") + "String_Node_Str" + booking.deal.hotelName);
  message.setSender("String_Node_Str");
  message.setTo(booking.user.email);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",booking.user);
  params.put("String_Node_Str",booking);
  send(message,template,params);
}
Program: 154199
Project: 154199
Buggy source:
public static void welcome(User user){
  Message message=new Message();
  message.setSubject("String_Node_Str" + user.firstName);
  message.setSender("String_Node_Str");
  message.setTo(user.email);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",user);
  send(message,template,params);
}

Fixed version (ground truth):
public static void welcome(User user){
  Message message=new Message();
  message.setSubject(Messages.get("String_Node_Str") + "String_Node_Str" + user.firstName);
  message.setSender("String_Node_Str");
  message.setTo(user.email);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",user);
  send(message,template,params);
}
Program: 154200
Project: 154200
Buggy source:
public static void hotelBookingConfirmation(Booking booking){
  Message message=new Message();
  message.setSubject("String_Node_Str" + booking.deal.hotelName);
  message.setSender("String_Node_Str");
  message.setTo(booking.deal.contactEmail);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",booking.user);
  params.put("String_Node_Str",booking);
  send(message,template,params);
}

Fixed version (ground truth):
public static void hotelBookingConfirmation(Booking booking){
  Message message=new Message();
  message.setSubject(Messages.get("String_Node_Str") + "String_Node_Str" + booking.deal.hotelName);
  message.setSender("String_Node_Str");
  message.setTo(booking.deal.contactEmail);
  String template="String_Node_Str";
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",booking.user);
  params.put("String_Node_Str",booking);
  send(message,template,params);
}
Program: 154201
Project: 154201
Buggy source:
/** 
 * Paint the world view.
 */
protected void paintComponent(Graphics g){
  if (!updating) {
    updating=true;
    try {
      IFuture fut=agent.scheduleStep(new UpdateStep());
      fut.addResultListener(new SwingDefaultResultListener(){
        public void customResultAvailable(        Object source,        Object result){
          AmbrosioPanel.this.drawdata=(DrawData)result;
          updating=false;
        }
        public void customExceptionOccurred(        Object source,        Exception exception){
        }
      }
);
    }
 catch (    ComponentTerminatedException e) {
    }
  }
  if (drawdata != null) {
  }
}

Fixed version (ground truth):
/** 
 * Paint the world view.
 */
protected void paintComponent(Graphics g){
  if (!updating) {
    updating=true;
    try {
      IFuture fut=agent.scheduleStep(new UpdateStep());
      fut.addResultListener(new SwingDefaultResultListener(){
        public void customResultAvailable(        Object source,        Object result){
          AmbrosioPanel.this.drawdata=(DrawData)result;
          updating=false;
        }
        public void customExceptionOccurred(        Object source,        Exception exception){
        }
      }
);
    }
 catch (    ComponentTerminatedException e) {
    }
  }
  if (drawdata != null) {
    Rectangle bounds=getBounds();
    g.setColor(Color.lightGray);
    g.fillRect(0,0,bounds.width,bounds.height);
  }
}
Program: 154203
Project: 154203
Buggy source:
public void body(){
  IMessageEvent message=(IMessageEvent)getReason();
  IMessageEvent ans=getEventbase().createReply(message,"String_Node_Str");
  double dice=Math.random();
  if (dice < 0.95) {
    ans.getParameter(SFipa.CONTENT).setValue(Status.OK);
  }
 else   if (0.95 <= dice && dice < 1.0) {
    ans.getParameter(SFipa.CONTENT).setValue(Status.ERROR);
  }
 else {
    ans.getParameter(SFipa.CONTENT).setValue(Status.OFFLINE);
  }
  sendMessage(ans);
}

Fixed version (ground truth):
public void body(){
  IMessageEvent message=(IMessageEvent)getReason();
  IMessageEvent ans=getEventbase().createReply(message,"String_Node_Str");
  double dice=Math.random();
  if (dice < 1.0) {
    ans.getParameter(SFipa.CONTENT).setValue(Status.OK);
  }
 else   if (1.0 <= dice && dice < 1.0) {
    ans.getParameter(SFipa.CONTENT).setValue(Status.ERROR);
  }
 else {
    ans.getParameter(SFipa.CONTENT).setValue(Status.OFFLINE);
  }
  sendMessage(ans);
}
Program: 154204
Project: 154204
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  try {
    SAXParser parser=SAXParserFactory.newInstance().newSAXParser();
    PicasaHandler picasaHandler=new PicasaHandler();
    URL picasaFeed=new URL("String_Node_Str");
    parser.parse(picasaFeed.openStream(),picasaHandler);
    PicasaAlbum album=picasaHandler.getParsedAlbum();
    Log.d("String_Node_Str","String_Node_Str" + album.getAlbumImages().size() + "String_Node_Str"+ album.getTitle()+ "String_Node_Str"+ album.getAuthor());
  }
 catch (  SAXException saxException) {
    saxException.printStackTrace();
  }
catch (  MalformedURLException murlException) {
    murlException.printStackTrace();
  }
catch (  IOException ioe) {
    ioe.printStackTrace();
  }
catch (  ParserConfigurationException pce) {
    pce.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  try {
    SAXParser parser=SAXParserFactory.newInstance().newSAXParser();
    PicasaHandler picasaHandler=new PicasaHandler();
    URL picasaFeed=new URL("String_Node_Str");
    parser.parse(picasaFeed.openStream(),picasaHandler);
    PicasaAlbum album=picasaHandler.getParsedAlbum();
    Log.d("String_Node_Str","String_Node_Str" + album.getAlbumImages().size() + "String_Node_Str"+ album.getTitle()+ "String_Node_Str"+ album.getAuthor());
    ImageAlbumDatabaseHelper databaseHelper=new ImageAlbumDatabaseHelper(getApplicationContext());
    PicasaAlbumManager albumManager=databaseHelper.getAlbumManager();
    long albumId=albumManager.addAlbum(album);
    if (albumId > 0) {
      Log.d(getClass().toString(),"String_Node_Str");
    }
 else {
      Log.e(getClass().toString(),"String_Node_Str");
      Log.e(getClass().toString(),"String_Node_Str");
      System.exit(1);
    }
  }
 catch (  SAXException saxException) {
    saxException.printStackTrace();
  }
catch (  MalformedURLException murlException) {
    murlException.printStackTrace();
  }
catch (  IOException ioe) {
    ioe.printStackTrace();
  }
catch (  ParserConfigurationException pce) {
    pce.printStackTrace();
  }
}
Program: 154205
Project: 154205
Buggy source:
/** 
 * @return the primary key for the stored album or-1 if it failed
 */
protected long addAlbum(PicasaAlbum album){
  ContentValues values=new ContentValues();
  values.put(TITLE,album.getTitle());
  values.put(AUTHOR,album.getAuthor());
  values.put(PUB_DATE,album.getCreatedDate().toGMTString());
  long albumId=db.insert(ALBUM_TABLE,TITLE,values);
  if (albumId > 0 && album.getAlbumImages().size() > 0) {
    PicasaImageManager imageTable=new PicasaImageManager(this.db);
    ImageAlbumRelationshipManager imageAlbumRelationships=new ImageAlbumRelationshipManager(this.db);
    for (    PicasaImage image : album.getAlbumImages()) {
      long imageId=imageTable.addOrUpdateImage(image);
      boolean storedNewRelation=imageAlbumRelationships.addImageAlbumRelation(albumId,imageId);
      if (!storedNewRelation) {
        Log.e("String_Node_Str","String_Node_Str" + album.getTitle() + "String_Node_Str"+ image.getThumbnailLocation());
        Log.e("String_Node_Str","String_Node_Str");
        System.exit(1);
      }
    }
  }
  return albumId;
}

Fixed version (ground truth):
/** 
 * @return the primary key for the stored album or-1 if it failed
 */
public long addAlbum(PicasaAlbum album){
  ContentValues values=new ContentValues();
  values.put(TITLE,album.getTitle());
  values.put(AUTHOR,album.getAuthor());
  values.put(PUB_DATE,album.getCreatedDate().toGMTString());
  long albumId=db.insert(ALBUM_TABLE,TITLE,values);
  if (albumId > 0 && album.getAlbumImages().size() > 0) {
    PicasaImageManager imageTable=new PicasaImageManager(this.db);
    ImageAlbumRelationshipManager imageAlbumRelationships=new ImageAlbumRelationshipManager(this.db);
    for (    PicasaImage image : album.getAlbumImages()) {
      long imageId=imageTable.addOrUpdateImage(image);
      boolean storedNewRelation=imageAlbumRelationships.addImageAlbumRelation(albumId,imageId);
      if (!storedNewRelation) {
        Log.e("String_Node_Str","String_Node_Str" + album.getTitle() + "String_Node_Str"+ image.getThumbnailLocation());
        Log.e("String_Node_Str","String_Node_Str");
        System.exit(1);
      }
    }
  }
  return albumId;
}
Program: 154206
Project: 154206
Buggy source:
private PicasaImage createImageFromCursor(Cursor cursor){
  PicasaImage image=new PicasaImage();
  image.setTitle(cursor.getString(cursor.getColumnIndex(TITLE)));
  image.setAuthor(cursor.getString(cursor.getColumnIndex(AUTHOR)));
  image.setPublicationDate(Date.valueOf(cursor.getString(cursor.getColumnIndex(PUB_DATE))));
  byte[] imageBytes=cursor.getBlob(cursor.getColumnIndex(IMAGE));
  image.setImage(BitmapFactory.decodeByteArray(imageBytes,0,imageBytes.length));
  byte[] thumbnailBytes=cursor.getBlob(cursor.getColumnIndex(IMAGE_THUMBNAIL));
  image.setThumbnail(BitmapFactory.decodeByteArray(thumbnailBytes,0,thumbnailBytes.length));
  return image;
}

Fixed version (ground truth):
private PicasaImage createImageFromCursor(Cursor cursor){
  PicasaImage image=new PicasaImage();
  image.setTitle(cursor.getString(cursor.getColumnIndex(TITLE)));
  image.setAuthor(cursor.getString(cursor.getColumnIndex(AUTHOR)));
  image.setPublicationDate(Date.valueOf(cursor.getString(cursor.getColumnIndex(PUB_DATE))));
  byte[] imageBytes=cursor.getBlob(cursor.getColumnIndex(IMAGE));
  image.setImageBytes(imageBytes);
  byte[] thumbnailBytes=cursor.getBlob(cursor.getColumnIndex(IMAGE_THUMBNAIL));
  image.setThumbnailBytes(thumbnailBytes);
  return image;
}
Program: 154207
Project: 154207
Buggy source:
protected long addImage(PicasaImage image){
  ContentValues values=new ContentValues();
  values.put(TITLE,image.getTitle());
  values.put(AUTHOR,image.getAuthor());
  values.put(PUB_DATE,image.getPublicationDate().toGMTString());
  if (image.getThumbnail() != null) {
    values.put(IMAGE_THUMBNAIL,compressToPNGBytes(image.getThumbnail()));
  }
  if (image.getImage() != null) {
    values.put(IMAGE,compressToPNGBytes(image.getImage()));
  }
  return db.insert(IMAGE_TABLE,TITLE,values);
}

Fixed version (ground truth):
protected long addImage(PicasaImage image){
  ContentValues values=new ContentValues();
  values.put(TITLE,image.getTitle());
  values.put(AUTHOR,image.getAuthor());
  values.put(PUB_DATE,image.getPublicationDate().toGMTString());
  values.put(IMAGE_THUMBNAIL,image.getThumbnailBytes());
  values.put(IMAGE,image.getImageBytes());
  return db.insert(IMAGE_TABLE,TITLE,values);
}
Program: 154208
Project: 154208
Buggy source:
public Bitmap getThumbnail(){
  return thumbnail;
}

Fixed version (ground truth):
public Bitmap getThumbnail(){
  if (thumbnail == null && thumbnailLocation != null) {
    getThumbnailBytes();
    thumbnail=BitmapFactory.decodeByteArray(thumbnailBytes,0,thumbnailBytes.length);
  }
  return thumbnail;
}
Program: 154209
Project: 154209
Buggy source:
public Bitmap getImage(){
  return image;
}

Fixed version (ground truth):
public Bitmap getImage(){
  if (image == null && imageLocation != null) {
    getImageBytes();
    image=BitmapFactory.decodeByteArray(imageBytes,0,imageBytes.length);
  }
  return image;
}
Program: 154211
Project: 154211
Buggy source:
public void updateState(MachineState state,List<Move> moves){
  for (  Proposition p : basePropositions.values()) {
    p.setValue(false);
  }
  for (  GdlSentence s : state.getContents()) {
    basePropositions.get(s.toTerm()).setValue(true);
  }
  for (  Proposition p : inputPropositions.values()) {
    p.setValue(false);
  }
  if (moves != null) {
    List<GdlTerm> does=toDoes(moves);
    for (    GdlTerm term : does) {
      Proposition p=inputPropositions.get(term);
      p.setValue(true);
    }
  }
  initProposition.setValue(false);
  for (  Proposition p : ordering) {
    if (p.getInputs().size() == 1) {
      p.setValue(p.getSingleInput().getValue());
    }
  }
  if (moves != null)   savedState=null;
 else   savedState=state;
}

Fixed version (ground truth):
public void updateState(MachineState state,List<Move> moves){
  if (savedState == null || state != savedState) {
    for (    Proposition p : basePropositions.values()) {
      p.setValue(false);
    }
    for (    GdlSentence s : state.getContents()) {
      basePropositions.get(s.toTerm()).setValue(true);
    }
  }
  for (  Proposition p : inputPropositions.values()) {
    p.setValue(false);
  }
  if (moves != null) {
    List<GdlTerm> does=toDoes(moves);
    for (    GdlTerm term : does) {
      Proposition p=inputPropositions.get(term);
      p.setValue(true);
    }
  }
  initProposition.setValue(false);
  for (  Proposition p : ordering) {
    if (p.getInputs().size() == 1) {
      p.setValue(p.getSingleInput().getValue());
    }
  }
  if (moves != null)   savedState=null;
 else   savedState=state;
}
Program: 154212
Project: 154212
Buggy source:
/** 
 * Returns the initial state. The initial state can be computed by only setting the truth value of the INIT proposition to true, and then computing the resulting state.
 */
@Override public MachineState getInitialState(){
  for (  Proposition p : propNet.getInputPropositions().values()) {
    p.setValue(false);
  }
  for (  Proposition p : propNet.getBasePropositions().values()) {
    p.setValue(false);
  }
  propNet.getInitProposition().setValue(true);
  for (  Proposition p : ordering) {
    if (p.getInputs().size() == 1) {
      p.setValue(p.getSingleInput().getValue());
    }
  }
  return getStateFromBase();
}

Fixed version (ground truth):
/** 
 * Returns the initial state. The initial state can be computed by only setting the truth value of the INIT proposition to true, and then computing the resulting state.
 */
@Override public MachineState getInitialState(){
  for (  Proposition p : inputPropositions.values()) {
    p.setValue(false);
  }
  for (  Proposition p : basePropositions.values()) {
    p.setValue(false);
  }
  propNet.getInitProposition().setValue(true);
  for (  Proposition p : ordering) {
    if (p.getInputs().size() == 1) {
      p.setValue(p.getSingleInput().getValue());
    }
  }
  return getStateFromBase();
}
Program: 154214
Project: 154214
Buggy source:
/** 
 * Computes if the state is terminal. Should return the value of the terminal proposition for the state.
 */
@Override public boolean isTerminal(MachineState state){
  if (savedState != state)   updateState(state,null);
  System.out.println("String_Node_Str" + getStateFromBase());
  return terminalProposition.getValue();
}

Fixed version (ground truth):
/** 
 * Computes if the state is terminal. Should return the value of the terminal proposition for the state.
 */
@Override public boolean isTerminal(MachineState state){
  if (savedState != state)   updateState(state,null);
  return terminalProposition.getValue();
}
Program: 154215
Project: 154215
Buggy source:
/** 
 * Computes the legal moves for role in state.
 */
@Override public List<Move> getLegalMoves(MachineState state,Role role) throws MoveDefinitionException {
  System.out.println("String_Node_Str" + state);
  System.out.println("String_Node_Str" + getStateFromBase());
  if (savedState != state)   updateState(state,null);
  List<Move> moves=new ArrayList<Move>();
  for (  Proposition p : legalPropositions.get(role)) {
    System.out.println("String_Node_Str" + p);
    if (p.getValue()) {
      moves.add(getMoveFromProposition(p));
    }
  }
  System.out.println("String_Node_Str" + getStateFromBase());
  return moves;
}

Fixed version (ground truth):
/** 
 * Computes the legal moves for role in state.
 */
@Override public List<Move> getLegalMoves(MachineState state,Role role) throws MoveDefinitionException {
  if (savedState != state)   updateState(state,null);
  List<Move> moves=new ArrayList<Move>();
  for (  Proposition p : legalPropositions.get(role)) {
    if (p.getValue()) {
      moves.add(getMoveFromProposition(p));
    }
  }
  return moves;
}
Program: 154216
Project: 154216
Buggy source:
/** 
 * Computes the goal for a role in the current state. Should return the value of the goal proposition that is true for that role. If there is not exactly one goal proposition true for that role, then you should throw a GoalDefinitionException because the goal is ill-defined. 
 */
@Override public int getGoal(MachineState state,Role role) throws GoalDefinitionException {
  if (savedState != state)   updateState(state,null);
  Integer goalValue=null;
  for (  Proposition p : goalPropositions.get(role)) {
    if (p.getValue()) {
      if (goalValue != null)       throw new GoalDefinitionException(state,role);
    }
    goalValue=getGoalValue(p);
  }
  if (goalValue == null)   throw new GoalDefinitionException(state,role);
  System.out.println("String_Node_Str" + getStateFromBase());
  return goalValue;
}

Fixed version (ground truth):
/** 
 * Computes the goal for a role in the current state. Should return the value of the goal proposition that is true for that role. If there is not exactly one goal proposition true for that role, then you should throw a GoalDefinitionException because the goal is ill-defined. 
 */
@Override public int getGoal(MachineState state,Role role) throws GoalDefinitionException {
  if (savedState != state)   updateState(state,null);
  Integer goalValue=null;
  for (  Proposition p : goalPropositions.get(role)) {
    if (p.getValue()) {
      if (goalValue != null) {
        throw new GoalDefinitionException(state,role);
      }
      goalValue=getGoalValue(p);
    }
  }
  if (goalValue == null)   throw new GoalDefinitionException(state,role);
  return goalValue;
}
Program: 154217
Project: 154217
Buggy source:
/** 
 * Computes the next state given state and the list of moves.
 */
@Override public MachineState getNextState(MachineState state,List<Move> moves) throws TransitionDefinitionException {
  updateState(state,moves);
  System.out.println("String_Node_Str" + getStateFromBase());
  return getStateFromBase();
}

Fixed version (ground truth):
/** 
 * Computes the next state given state and the list of moves.
 */
@Override public MachineState getNextState(MachineState state,List<Move> moves) throws TransitionDefinitionException {
  updateState(state,moves);
  return getStateFromBase();
}
Program: 154218
Project: 154218
Buggy source:
/** 
 * Initializes the PropNetStateMachine. You should compute the topological ordering here. Additionally you may compute the initial state here, at your discretion.
 */
@Override public void initialize(List<Gdl> description){
  propNet=CachedPropNetFactory.create(description);
  propNet.renderToFile("String_Node_Str");
  roles=propNet.getRoles();
  savedState=null;
  inputPropositions=propNet.getInputPropositions();
  basePropositions=propNet.getBasePropositions();
  legalPropositions=propNet.getLegalPropositions();
  goalPropositions=propNet.getGoalPropositions();
  initProposition=propNet.getInitProposition();
  terminalProposition=propNet.getTerminalProposition();
  ordering=getOrdering();
  System.out.println("String_Node_Str");
  for (  Component c : ordering) {
    System.out.println(c);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the PropNetStateMachine. You should compute the topological ordering here. Additionally you may compute the initial state here, at your discretion.
 */
@Override public void initialize(List<Gdl> description){
  propNet=OptimizingPropNetFactory.create(description);
  propNet.renderToFile(new File(System.getProperty("String_Node_Str"),"String_Node_Str").toString());
  roles=propNet.getRoles();
  savedState=null;
  inputPropositions=propNet.getInputPropositions();
  basePropositions=propNet.getBasePropositions();
  legalPropositions=propNet.getLegalPropositions();
  goalPropositions=propNet.getGoalPropositions();
  initProposition=propNet.getInitProposition();
  terminalProposition=propNet.getTerminalProposition();
  ordering=getOrdering();
  System.out.println("String_Node_Str");
  for (  Component c : ordering) {
    System.out.println(c);
  }
}
Program: 154219
Project: 154219
Buggy source:
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new ProverStateMachine();
}

Fixed version (ground truth):
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new DumplingPropNetStateMachine();
}
Program: 154220
Project: 154220
Buggy source:
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new ProverStateMachine();
}

Fixed version (ground truth):
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new DumplingPropNetStateMachine();
}
Program: 154221
Project: 154221
Buggy source:
@Override public void stateMachineMetaGame(long timeout) throws TransitionDefinitionException, MoveDefinitionException, GoalDefinitionException {
  strategy=new IDSAlphaBeta(getStateMachine());
  metaStrategy=new MonteCarloMiniMax(getStateMachine(),5);
  metaStrategy.getBestMove(getCurrentState(),getRole(),timeout);
  strategy.setExternalCache(((MonteCarloMiniMax)metaStrategy).maxStateScores);
  AbstractHeuristic heuristic=new MonteCarlo(getStateMachine());
  ((MonteCarlo)heuristic).setSampleSize(3);
  strategy.setHeuristic(heuristic);
}

Fixed version (ground truth):
@Override public void stateMachineMetaGame(long timeout) throws TransitionDefinitionException, MoveDefinitionException, GoalDefinitionException {
  strategy=new IDSAlphaBeta(getStateMachine());
  metaStrategy=new MonteCarloMiniMax(getStateMachine(),5);
  metaStrategy.getBestMove(getCurrentState(),getRole(),timeout);
  strategy.setExternalCache(((MonteCarloMiniMax)metaStrategy).maxStateScores);
  AbstractHeuristic heuristic=new MonteCarlo(getStateMachine());
  ((MonteCarlo)heuristic).setSampleSize(5);
  strategy.setHeuristic(heuristic);
}
Program: 154222
Project: 154222
Buggy source:
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new ProverStateMachine();
}

Fixed version (ground truth):
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new DumplingPropNetStateMachine();
}
Program: 154223
Project: 154223
Buggy source:
@Override public void stateMachineMetaGame(long timeout) throws TransitionDefinitionException, MoveDefinitionException, GoalDefinitionException {
  strategy=new AlphaBeta(getStateMachine(),3);
  strategy.setHeuristic(new MonteCarlo(getStateMachine()));
}

Fixed version (ground truth):
@Override public void stateMachineMetaGame(long timeout) throws TransitionDefinitionException, MoveDefinitionException, GoalDefinitionException {
  strategy=new IDSAlphaBeta(getStateMachine());
  AbstractHeuristic heuristic=new MonteCarlo(getStateMachine());
  ((MonteCarlo)heuristic).setSampleSize(5);
  strategy.setHeuristic(heuristic);
}
Program: 154224
Project: 154224
Buggy source:
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new ProverStateMachine();
}

Fixed version (ground truth):
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new DumplingPropNetStateMachine();
}
Program: 154225
Project: 154225
Buggy source:
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new DumplingPropNetStateMachine();
}

Fixed version (ground truth):
@Override public StateMachine getInitialStateMachine(){
  return new DumplingPropNetStateMachine();
}
Program: 154226
Project: 154226
Buggy source:
/** 
 * Computes if the state is terminal. Should return the value of the terminal proposition for the state.
 */
@Override public boolean isTerminal(MachineState state){
  return propNet.getTerminalProposition().getValue();
}

Fixed version (ground truth):
/** 
 * Computes if the state is terminal. Should return the value of the terminal proposition for the state.
 */
@Override public boolean isTerminal(MachineState state){
  updateState(state,null);
  return propNet.getTerminalProposition().getValue();
}
Program: 154227
Project: 154227
Buggy source:
/** 
 * Computes the legal moves for role in state.
 */
@Override public List<Move> getLegalMoves(MachineState state,Role role) throws MoveDefinitionException {
  List<Move> moves=new ArrayList<Move>();
  Set<Proposition> legalPropositions=propNet.getLegalPropositions().get(role);
  while (legalPropositions.iterator().hasNext()) {
    Proposition p=legalPropositions.iterator().next();
    moves.add(DumplingPropNetStateMachine.getMoveFromProposition(p));
  }
  return moves;
}

Fixed version (ground truth):
/** 
 * Computes the legal moves for role in state.
 */
@Override public List<Move> getLegalMoves(MachineState state,Role role) throws MoveDefinitionException {
  updateState(state,null);
  List<Move> moves=new ArrayList<Move>();
  for (  Proposition p : propNet.getLegalPropositions().get(role)) {
    if (p.getValue()) {
      moves.add(getMoveFromProposition(p));
    }
  }
  return moves;
}
Program: 154228
Project: 154228
Buggy source:
/** 
 * Computes the goal for a role in the current state. Should return the value of the goal proposition that is true for that role. If there is not exactly one goal proposition true for that role, then you should throw a GoalDefinitionException because the goal is ill-defined. 
 */
@Override public int getGoal(MachineState state,Role role) throws GoalDefinitionException {
  Set<Proposition> goalPropositions=propNet.getGoalPropositions().get(role);
  if (goalPropositions.size() != 1)   throw new GoalDefinitionException(state,role);
  return getGoalValue(goalPropositions.iterator().next());
}

Fixed version (ground truth):
/** 
 * Computes the goal for a role in the current state. Should return the value of the goal proposition that is true for that role. If there is not exactly one goal proposition true for that role, then you should throw a GoalDefinitionException because the goal is ill-defined. 
 */
@Override public int getGoal(MachineState state,Role role) throws GoalDefinitionException {
  updateState(state,null);
  Integer goalValue=null;
  for (  Proposition p : propNet.getGoalPropositions().get(role)) {
    if (p.getValue()) {
      if (goalValue != null)       throw new GoalDefinitionException(state,role);
    }
    goalValue=getGoalValue(p);
  }
  if (goalValue == null)   throw new GoalDefinitionException(state,role);
  return goalValue;
}
Program: 154229
Project: 154229
Buggy source:
/** 
 * Computes the next state given state and the list of moves.
 */
@Override public MachineState getNextState(MachineState state,List<Move> moves) throws TransitionDefinitionException {
  List<GdlTerm> does=toDoes(moves);
  Map<GdlTerm,Proposition> inputs=propNet.getInputPropositions();
  for (  Proposition p : inputs.values()) {
    p.setValue(false);
  }
  for (  GdlTerm term : does) {
    Proposition p=inputs.get(term);
    p.setValue(true);
  }
  for (  Proposition p : ordering) {
    if (p.getInputs().size() == 1) {
      p.setValue(p.getSingleInput().getValue());
    }
  }
  return getStateFromBase();
}

Fixed version (ground truth):
/** 
 * Computes the next state given state and the list of moves.
 */
@Override public MachineState getNextState(MachineState state,List<Move> moves) throws TransitionDefinitionException {
  updateState(state,moves);
  return getStateFromBase();
}
Program: 154230
Project: 154230
Buggy source:
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new ProverStateMachine();
}

Fixed version (ground truth):
/** 
 * Uses a ProverStateMachine
 */
@Override public StateMachine getInitialStateMachine(){
  return new DumplingPropNetStateMachine();
}
Program: 154231
Project: 154231
Buggy source:
@Override public void stateMachineMetaGame(long timeout) throws TransitionDefinitionException, MoveDefinitionException, GoalDefinitionException {
  strategy=new MiniMax(getStateMachine());
  strategy.enableCache(false);
}

Fixed version (ground truth):
@Override public void stateMachineMetaGame(long timeout) throws TransitionDefinitionException, MoveDefinitionException, GoalDefinitionException {
  strategy=new MiniMax(getStateMachine());
}
Program: 154232
Project: 154232
Buggy source:
private int minScore(Role role,Move move,MachineState state,int alpha,int beta) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  int worstScore=Integer.MAX_VALUE;
  String stateString=canonicalizeStateString(state);
  String moveString=move.toString();
  Map<String,Integer> stateMoveScores=minStateScores.get(stateString);
  if (useCaching && stateMoveScores != null && stateMoveScores.get(moveString) != null)   return stateMoveScores.get(moveString);
  List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
  for (  List<Move> jointMove : allJointMoves) {
    MachineState newState=stateMachine.getNextState(state,jointMove);
    int newScore=maxScore(role,newState,alpha,beta);
    if (newScore < worstScore)     worstScore=newScore;
    beta=Math.min(beta,worstScore);
    if (beta <= alpha) {
      worstScore=beta;
      break;
    }
  }
  if (stateMoveScores == null)   minStateScores.put(stateString,(stateMoveScores=new HashMap<String,Integer>()));
  stateMoveScores.put(moveString,worstScore);
  return worstScore;
}

Fixed version (ground truth):
private int minScore(Role role,Move move,MachineState state,int alpha,int beta) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  int worstScore=Integer.MAX_VALUE;
  String stateString=canonicalizeStateString(state,alpha,beta);
  String moveString=move.toString();
  Map<String,Integer> stateMoveScores=minStateScores.get(stateString);
  if (useCaching && stateMoveScores != null && stateMoveScores.get(moveString) != null)   return stateMoveScores.get(moveString);
  List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
  for (  List<Move> jointMove : allJointMoves) {
    MachineState newState=stateMachine.getNextState(state,jointMove);
    int newScore=maxScore(role,newState,alpha,beta);
    if (newScore < worstScore)     worstScore=newScore;
    beta=Math.min(beta,worstScore);
    if (beta <= alpha) {
      worstScore=beta;
      break;
    }
  }
  if (stateMoveScores == null)   minStateScores.put(stateString,(stateMoveScores=new HashMap<String,Integer>()));
  stateMoveScores.put(moveString,worstScore);
  return worstScore;
}
Program: 154233
Project: 154233
Buggy source:
private String canonicalizeStateString(MachineState state){
  Set<String> sortedStateContents=new TreeSet<String>();
  for (  GdlSentence gdl : state.getContents())   sortedStateContents.add(gdl.toString());
  return sortedStateContents.toString();
}

Fixed version (ground truth):
private String canonicalizeStateString(MachineState state,int alpha,int beta){
  Set<String> sortedStateContents=new TreeSet<String>();
  for (  GdlSentence gdl : state.getContents()) {
    sortedStateContents.add(gdl.toString());
  }
  return alpha + "String_Node_Str" + beta+ "String_Node_Str"+ sortedStateContents.toString();
}
Program: 154234
Project: 154234
Buggy source:
public AlphaBeta(StateMachine sm){
  super(sm);
  maxStateScores=new HashMap<String,Integer>();
  minStateScores=new HashMap<String,Map<String,Integer>>();
  t=new Timer(0,TimeoutHandler);
  t.setRepeats(false);
}

Fixed version (ground truth):
public AlphaBeta(StateMachine sm){
  super(sm);
  maxStateScores=new HashMap<String,Integer>();
  minStateScores=new HashMap<String,Map<String,Integer>>();
}
Program: 154235
Project: 154235
Buggy source:
public Move getBestMove(MachineState state,Role role,long timeout) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  t.setDelay((int)timeout);
  if (t.isRunning())   t.restart();
 else   t.start();
  List<Move> moves=stateMachine.getLegalMoves(state,role);
  if (moves.size() == 1)   return moves.get(0);
 else {
    Move bestMove=null;
    int bestValue=Integer.MIN_VALUE;
    for (    Move move : moves) {
      int value=minScore(role,move,state,Integer.MIN_VALUE,Integer.MAX_VALUE);
      if (value > bestValue) {
        bestValue=value;
        bestMove=move;
      }
    }
    System.out.println("String_Node_Str" + bestValue);
    return bestMove;
  }
}

Fixed version (ground truth):
public Move getBestMove(MachineState state,Role role,long timeout) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  t=new Timer((int)(timeout - System.currentTimeMillis()),TimeoutHandler);
  t.setRepeats(false);
  t.start();
  List<Move> moves=stateMachine.getLegalMoves(state,role);
  if (moves.size() == 1) {
    System.out.println("String_Node_Str");
    return moves.get(0);
  }
 else {
    Move bestMove=null;
    int bestValue=Integer.MIN_VALUE;
    numStatesExpanded=1;
    for (    Move move : moves) {
      int value=minScore(role,move,state,Integer.MIN_VALUE,Integer.MAX_VALUE);
      if (value > bestValue) {
        bestValue=value;
        bestMove=move;
      }
    }
    System.out.println("String_Node_Str" + bestValue);
    System.out.println("String_Node_Str" + numStatesExpanded + "String_Node_Str");
    return bestMove;
  }
}
Program: 154236
Project: 154236
Buggy source:
private int maxScore(Role role,MachineState state,int alpha,int beta) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state))   return stateMachine.getGoal(state,role);
  String stateString=canonicalizeStateString(state);
  if (useCaching && maxStateScores.get(stateString) != null)   return maxStateScores.get(stateString);
  int bestValue=Integer.MIN_VALUE;
  for (  Move move : stateMachine.getLegalMoves(state,role)) {
    int value=minScore(role,move,state,alpha,beta);
    if (value > bestValue)     bestValue=value;
    alpha=Math.max(alpha,bestValue);
    if (alpha >= beta) {
      bestValue=alpha;
      break;
    }
  }
  maxStateScores.put(stateString,bestValue);
  return bestValue;
}

Fixed version (ground truth):
private int maxScore(Role role,MachineState state,int alpha,int beta) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state)) {
    numStatesExpanded++;
    return stateMachine.getGoal(state,role);
  }
  String stateString=canonicalizeStateString(state,alpha,beta);
  if (useCaching && maxStateScores.get(stateString) != null)   return maxStateScores.get(stateString);
  numStatesExpanded++;
  int bestValue=Integer.MIN_VALUE;
  for (  Move move : stateMachine.getLegalMoves(state,role)) {
    int value=minScore(role,move,state,alpha,beta);
    if (value > bestValue)     bestValue=value;
    alpha=Math.max(alpha,bestValue);
    if (alpha >= beta) {
      bestValue=alpha;
      break;
    }
  }
  maxStateScores.put(stateString,bestValue);
  return bestValue;
}
Program: 154237
Project: 154237
Buggy source:
public Move getBestMove(MachineState state,Role role,long timeout) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  System.out.println("String_Node_Str");
  List<Move> moves=stateMachine.getLegalMoves(state,role);
  if (moves.size() == 1) {
    System.out.println("String_Node_Str");
    return moves.get(0);
  }
 else {
    Move bestMove=null;
    int bestValue=Integer.MIN_VALUE;
    numStatesExpanded=1;
    for (    Move move : moves) {
      int value=minScore(role,move,state);
      if (value > bestValue) {
        bestValue=value;
        bestMove=move;
      }
    }
    System.out.println("String_Node_Str" + numStatesExpanded + "String_Node_Str");
    return bestMove;
  }
}

Fixed version (ground truth):
public Move getBestMove(MachineState state,Role role,long timeout) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  System.out.println("String_Node_Str");
  List<Move> moves=stateMachine.getLegalMoves(state,role);
  if (moves.size() == 1) {
    System.out.println("String_Node_Str");
    return moves.get(0);
  }
 else {
    Move bestMove=null;
    int bestValue=Integer.MIN_VALUE;
    numStatesExpanded=1;
    for (    Move move : moves) {
      int value=minScore(role,move,state);
      if (value > bestValue) {
        bestValue=value;
        bestMove=move;
      }
    }
    System.out.println("String_Node_Str" + bestValue + "String_Node_Str"+ "String_Node_Str"+ numStatesExpanded+ "String_Node_Str");
    return bestMove;
  }
}
Program: 154238
Project: 154238
Buggy source:
public void setHeuristic(PlayerHeuristic heuristic){
  this.heuristic=heuristic;
}

Fixed version (ground truth):
public void setHeuristic(AbstractHeuristic heuristic){
  this.heuristic=heuristic;
}
Program: 154239
Project: 154239
Buggy source:
private int maxScore(Role role,MachineState state,int alpha,int beta,int depth) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state)) {
    numStatesExpanded++;
    return stateMachine.getGoal(state,role);
  }
  String stateString=canonicalizeStateString(state,alpha,beta);
  if (useCaching && maxStateScores.get(stateString) != null)   return maxStateScores.get(stateString);
  numStatesExpanded++;
  int bestValue=Integer.MIN_VALUE;
  if (depth > maxDepth) {
    if (heuristic != null) {
      Integer value=heuristic.getScore(state,role);
      if (value != null)       return value;
    }
 else {
      return Integer.MIN_VALUE;
    }
  }
 else {
    for (    Move move : stateMachine.getLegalMoves(state,role)) {
      if (stopExecution) {
        break;
      }
      int value=minScore(role,move,state,alpha,beta,depth);
      if (value > bestValue)       bestValue=value;
      alpha=Math.max(alpha,bestValue);
      if (alpha >= beta) {
        bestValue=alpha;
        break;
      }
    }
    if (!stopExecution)     maxStateScores.put(stateString,bestValue);
  }
  return bestValue;
}

Fixed version (ground truth):
private int maxScore(Role role,MachineState state,int alpha,int beta,int depth) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state)) {
    numStatesExpanded++;
    return stateMachine.getGoal(state,role);
  }
  String stateString=canonicalizeStateString(state,alpha,beta);
  if (useCaching && maxStateScores.get(stateString) != null)   return maxStateScores.get(stateString);
  numStatesExpanded++;
  int bestValue=Integer.MIN_VALUE;
  if (depth > maxDepth) {
    if (heuristic != null) {
      Integer value=heuristic.getScore(state,role);
      if (value != null)       return value;
    }
 else {
      return 1;
    }
  }
 else {
    for (    Move move : stateMachine.getLegalMoves(state,role)) {
      if (stopExecution) {
        break;
      }
      int value=minScore(role,move,state,alpha,beta,depth);
      if (value > bestValue)       bestValue=value;
      alpha=Math.max(alpha,bestValue);
      if (alpha >= beta) {
        bestValue=alpha;
        break;
      }
    }
    if (!stopExecution)     maxStateScores.put(stateString,bestValue);
  }
  return bestValue;
}
Program: 154240
Project: 154240
Buggy source:
private int minScore(Role role,Move move,MachineState state,int alpha,int beta,int depth) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  String stateString=canonicalizeStateString(state,alpha,beta);
  String moveString=move.toString();
  Map<String,Integer> stateMoveScores=minStateScores.get(stateString);
  if (useCaching && stateMoveScores != null && stateMoveScores.get(moveString) != null)   return stateMoveScores.get(moveString);
  List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
  int worstScore=Integer.MAX_VALUE;
  for (  List<Move> jointMove : allJointMoves) {
    if (stopExecution) {
      break;
    }
    MachineState newState=stateMachine.getNextState(state,jointMove);
    int newScore=maxScore(role,newState,alpha,beta,depth + 1);
    if (newScore < worstScore)     worstScore=newScore;
    beta=Math.min(beta,worstScore);
    if (beta <= alpha) {
      worstScore=beta;
      break;
    }
  }
  if (heuristic == null || depth <= maxDepth) {
    if (stateMoveScores == null)     minStateScores.put(stateString,(stateMoveScores=new HashMap<String,Integer>()));
    stateMoveScores.put(moveString,worstScore);
  }
  return worstScore;
}

Fixed version (ground truth):
private int minScore(Role role,Move move,MachineState state,int alpha,int beta,int depth) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  String stateString=canonicalizeStateString(state,alpha,beta);
  String moveString=move.toString();
  Map<String,Integer> stateMoveScores=minStateScores.get(stateString);
  if (useCaching && stateMoveScores != null && stateMoveScores.get(moveString) != null)   return stateMoveScores.get(moveString);
  List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
  int worstScore=Integer.MAX_VALUE;
  for (  List<Move> jointMove : allJointMoves) {
    if (stopExecution) {
      break;
    }
    MachineState newState=stateMachine.getNextState(state,jointMove);
    int newScore=maxScore(role,newState,alpha,beta,depth + 1);
    if (newScore < worstScore)     worstScore=newScore;
    beta=Math.min(beta,worstScore);
    if (beta <= alpha) {
      worstScore=beta;
      break;
    }
  }
  if (heuristic == null || depth <= maxDepth) {
    if (stateMoveScores == null)     minStateScores.put(stateString,(stateMoveScores=new HashMap<String,Integer>()));
    stateMoveScores.put(moveString,worstScore);
  }
  if (worstScore == Integer.MAX_VALUE)   return 1;
  return worstScore;
}
Program: 154241
Project: 154241
Buggy source:
private int maxScore(Role role,MachineState state,int alpha,int beta,int depth) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state)) {
    numStatesExpanded++;
    return stateMachine.getGoal(state,role);
  }
  String stateString=canonicalizeStateString(state,alpha,beta);
  if (useCaching && maxStateScores.get(stateString) != null)   return maxStateScores.get(stateString);
  numStatesExpanded++;
  int bestValue=Integer.MIN_VALUE;
  if (depth > maxDepth) {
    if (heuristic != null) {
      Integer value=heuristic.getScore(state,role);
      if (value != null)       return value;
    }
 else {
      return 1;
    }
  }
 else {
    for (    Move move : stateMachine.getLegalMoves(state,role)) {
      if (stopExecution) {
        break;
      }
      int value=minScore(role,move,state,alpha,beta,depth);
      if (value > bestValue)       bestValue=value;
      alpha=Math.max(alpha,bestValue);
      if (alpha >= beta) {
        bestValue=alpha;
        break;
      }
    }
    if (!stopExecution)     maxStateScores.put(stateString,bestValue);
  }
  return bestValue;
}

Fixed version (ground truth):
private int maxScore(Role role,MachineState state,int alpha,int beta,int depth) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state)) {
    numStatesExpanded++;
    return stateMachine.getGoal(state,role);
  }
  String stateString=canonicalizeStateString(state,alpha,beta);
  if (useCaching && maxStateScores.get(stateString) != null)   return maxStateScores.get(stateString);
  numStatesExpanded++;
  int bestValue=Integer.MIN_VALUE;
  if (depth > maxDepth) {
    if (heuristic != null) {
      Integer value=heuristic.getScore(state,role);
      if (value != null)       return value;
    }
 else {
      return 1;
    }
  }
 else {
    for (    Move move : stateMachine.getLegalMoves(state,role)) {
      if (stopExecution) {
        break;
      }
      int value=minScore(role,move,state,alpha,beta,depth);
      if (value > bestValue)       bestValue=value;
      alpha=Math.max(alpha,bestValue);
      if (alpha >= beta) {
        bestValue=alpha;
        break;
      }
    }
    if (!stopExecution)     maxStateScores.put(stateString,bestValue);
  }
  if (bestValue == Integer.MIN_VALUE)   return 1;
  return bestValue;
}
Program: 154242
Project: 154242
Buggy source:
private int minScore(Role role,MachineState state) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state))   return stateMachine.getGoal(state,role);
  if (minStateScores.get(state.toString()) != null)   return minStateScores.get(state.toString());
  int worstValue=Integer.MAX_VALUE;
  for (  Move move : stateMachine.getLegalMoves(state,role)) {
    List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
    for (    List<Move> jointMove : allJointMoves) {
      MachineState newState=stateMachine.getNextState(state,jointMove);
      int newValue=maxScore(role,newState);
      if (newValue < worstValue) {
        worstValue=newValue;
      }
    }
  }
  minStateScores.put(state.toString(),worstValue);
  return worstValue;
}

Fixed version (ground truth):
private int minScore(Role role,Move move,MachineState state) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  int worstScore=Integer.MAX_VALUE;
  List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
  for (  List<Move> jointMove : allJointMoves) {
    MachineState newState=stateMachine.getNextState(state,jointMove);
    int newScore=maxScore(role,newState);
    if (newScore < worstScore) {
      worstScore=newScore;
    }
  }
  return worstScore;
}
Program: 154243
Project: 154243
Buggy source:
public MiniMax(StateMachine sm){
  super(sm);
  minStateScores=new HashMap<String,Integer>();
  maxStateScores=new HashMap<String,Integer>();
}

Fixed version (ground truth):
public MiniMax(StateMachine sm){
  super(sm);
  maxStateScores=new HashMap<String,Integer>();
}