Program: 72255
Project: 72255
Buggy source:
public String request(int sid,String msg){
  int playerIndex=0;
  for (int i=0; i < playerNum; i++) {
    if (allPlayers[i].SID == sid) {
      playerIndex=i;
      break;
    }
  }
  String result="String_Node_Str";
switch (gameState) {
case INIT:
    if (playerState[playerIndex] == 0) {
      result=GodHelper.toInit(allUserInfo,"String_Node_Str",playerIndex,heroList);
      playerState[playerIndex]+=1;
    }
 else     if (playerState[playerIndex] == 1) {
      heroChoose(sid,msg);
      gameState=GameState.MAINGAME;
      playerState[playerIndex]=0;
      result=GodHelper.toChooseHero("String_Node_Str",heroChoices,teamResult);
    }
  break;
case MAINGAME:
switch (phaseState) {
case PREPARE:
  if (playerState[playerIndex] == 0) {
    GambleChecker.cardDistribute(cardHeap,allPlayers[playerIndex],4);
    int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
    seenCardJudge(playerIndex,playerHandCard);
    for (int i=0; i < playerNum; i++) {
      if (MapChecker.distance(map.units[allPlayers[playerIndex].preLoc],map.units[allPlayers[i].preLoc]) < allPlayers[playerIndex].range)       availableFireTarget[i]=1;
    }
    toDirection(playerIndex);
    result=GodHelper.toCardDistribute("String_Node_Str",playerHandCard,availableFireTarget,availableMoveDirection);
    playerState[playerIndex]+=1;
  }
 else   if (playerState[playerIndex] == 1) {
    MsgChooseDecision dec=GodHelper.getChooseDecision(msg);
    if (dec.decision() == -1)     allPlayers[playerIndex].stratDecision=GambleChecker.DEPOSIT;
 else {
      allPlayers[playerIndex].stratDecision=allPlayers[playerIndex].handCards[dec.decision()];
      GambleChecker.cardToHeap(cardHeap,dec.decision());
      allPlayers[playerIndex].handCards[dec.decision()]=GambleChecker.NOTHING;
      GambleChecker.cardSort(allPlayers[playerIndex].handCards);
      allPlayers[playerIndex].handCardsNum-=1;
    }
    decisionChoices[playerIndex]=allPlayers[playerIndex].stratDecision;
    featureChoose(msg,allPlayers[playerIndex],playerIndex);
    int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
    for (int i=0; i < allPlayers[playerIndex].handCardsNum; i++)     playerHandCard[i]=allPlayers[playerIndex].handCards[i];
    if (allPlayers[playerIndex].isSeenCard)     result=GodHelper.toChooseDecision("String_Node_Str",playerHandCard);
 else     result=GodHelper.toChooseDecision("String_Node_Str",playerHandCard);
    playerState[playerIndex]+=1;
  }
 else   if (playerState[playerIndex] == 2) {
    seenCard(playerIndex,msg,allPlayers[playerIndex]);
    if (allPlayers[playerIndex].isSeenCard)     result=GodHelper.toSeenCard("String_Node_Str",decisionChoices,seenCardChoices);
 else     result=GodHelper.toSeenCard("String_Node_Str",decisionChoices,seenCardChoices);
    playerState[playerIndex]=0;
    phaseState=PhaseState.GAMBLE;
  }
break;
case GAMBLE:
if (playerState[playerIndex] == 0) {
gambleChoose(msg,allPlayers[playerIndex],playerIndex);
playerState[playerIndex]+=1;
int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
for (int i=0; i < allPlayers[playerIndex].handCardsNum; i++) playerHandCard[i]=allPlayers[playerIndex].handCards[i];
result=GodHelper.toChooseGamble("String_Node_Str",playerHandCard);
}
 else if (playerState[playerIndex] == 1) {
winJudge();
for (int i=0; i < playerNum; i++) {
  if (allPlayers[i].isWin)   playerWinList[i]=1;
}
playerState[playerIndex]=0;
phaseState=PhaseState.ACTION;
result=GodHelper.toWinJudge("String_Node_Str",gambleChoices,cardNumList,playerWinList,fireList);
}
break;
case ACTION:
if (playerState[playerIndex] == 0) {
depositAccount();
result=GodHelper.toDepositAccount("String_Node_Str",energyList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 1) {
skillsAccount();
result=GodHelper.toSkillsAccount("String_Node_Str");
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 2) {
fireAccount();
result=GodHelper.toFireAccount("String_Node_Str",healthPointList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 3) {
moveAccount();
result=GodHelper.toMoveAccount("String_Node_Str",locationList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 4) {
elemAccount();
result=GodHelper.toElemAccount("String_Node_Str",elementList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 5) {
humanVictory();
if (humanWin) {
result=GodHelper.toHumanVictory("String_Node_Str");
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else {
result=GodHelper.toHumanVictory("String_Node_Str");
playerState[playerIndex]+=1;
}
}
 else if (playerState[playerIndex] == 6) {
infectionAccount();
if (zombieWin) {
result=GodHelper.toInfectionAccount("String_Node_Str",teamList);
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else {
result=GodHelper.toInfectionAccount("String_Node_Str",teamList);
playerState[playerIndex]+=1;
}
}
 else if (playerState[playerIndex] == 7) {
desertAccount(playerIndex,msg);
int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
for (int i=0; i < allPlayers[playerIndex].handCardsNum; i++) playerHandCard[i]=allPlayers[playerIndex].handCards[i];
result=GodHelper.toDesertAccount("String_Node_Str",allPlayers[playerIndex].energy,playerHandCard);
phaseState=PhaseState.PREPARE;
playerState[playerIndex]=0;
seen_card_count=0;
gamble_count=0;
desert_count=0;
for (int i=0; i < playerNum; i++) {
allPlayers[i].stratDecision=GambleChecker.DEPOSIT;
availableFireTarget[i]=0;
decisionChoices[i]=GambleChecker.DEPOSIT;
seenCardChoices[i]=0;
gambleChoices[i]=GambleChecker.PAPER;
cardNumList[i]=0;
playerWinList[i]=0;
fireList[i]=-1;
}
}
break;
}
break;
case END:
result=GodHelper.toGameOver("String_Node_Str",scoreList);
break;
}
if (result.equals("String_Node_Str")) {
System.out.printf("String_Node_Str",sid,msg,gameState.toString());
}
return result;
}

Fixed version (ground truth):
public String request(int sid,String msg){
  int playerIndex=0;
  for (int i=0; i < playerNum; i++) {
    if (allPlayers[i].SID == sid) {
      playerIndex=i;
      break;
    }
  }
  String result="String_Node_Str";
switch (gameState) {
case INIT:
    if (playerState[playerIndex] == 0) {
      result=GodHelper.toInit(allUserInfo,"String_Node_Str",playerIndex,heroList);
      playerState[playerIndex]+=1;
    }
 else     if (playerState[playerIndex] == 1) {
      heroChoose(sid,msg);
      gameState=GameState.MAINGAME;
      playerState[playerIndex]=0;
      result=GodHelper.toChooseHero("String_Node_Str",heroChoices,teamResult);
    }
  break;
case MAINGAME:
switch (phaseState) {
case PREPARE:
  if (playerState[playerIndex] == 0) {
    GambleChecker.cardDistribute(cardHeap,allPlayers[playerIndex],4);
    int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
    seenCardJudge(playerIndex,playerHandCard);
    for (int i=0; i < playerNum; i++) {
      if (MapChecker.distance(map.units[allPlayers[playerIndex].preLoc],map.units[allPlayers[i].preLoc]) < allPlayers[playerIndex].range)       availableFireTarget[i]=1;
    }
    toDirection(playerIndex);
    result=GodHelper.toCardDistribute("String_Node_Str",playerHandCard,availableFireTarget,availableMoveDirection);
    playerState[playerIndex]+=1;
  }
 else   if (playerState[playerIndex] == 1) {
    MsgChooseDecision dec=GodHelper.getChooseDecision(msg);
    if (dec.decision() == -1)     allPlayers[playerIndex].stratDecision=GambleChecker.DEPOSIT;
 else {
      allPlayers[playerIndex].stratDecision=allPlayers[playerIndex].handCards[dec.decision()];
      GambleChecker.cardToHeap(cardHeap,dec.decision());
      allPlayers[playerIndex].handCards[dec.decision()]=GambleChecker.NOTHING;
      GambleChecker.cardSort(allPlayers[playerIndex].handCards);
      allPlayers[playerIndex].handCardsNum-=1;
    }
    decisionChoices[playerIndex]=allPlayers[playerIndex].stratDecision;
    featureChoose(msg,allPlayers[playerIndex],playerIndex);
    int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
    for (int i=0; i < allPlayers[playerIndex].handCardsNum; i++)     playerHandCard[i]=allPlayers[playerIndex].handCards[i];
    if (allPlayers[playerIndex].isSeenCard)     result=GodHelper.toChooseDecision("String_Node_Str",playerHandCard);
 else     result=GodHelper.toChooseDecision("String_Node_Str",playerHandCard);
    playerState[playerIndex]+=1;
  }
 else   if (playerState[playerIndex] == 2) {
    seenCard(playerIndex,msg,allPlayers[playerIndex]);
    if (allPlayers[playerIndex].isSeenCard)     result=GodHelper.toSeenCard("String_Node_Str",decisionChoices,seenCardChoices);
 else     result=GodHelper.toSeenCard("String_Node_Str",decisionChoices,seenCardChoices);
    playerState[playerIndex]=0;
    phaseState=PhaseState.GAMBLE;
  }
break;
case GAMBLE:
if (playerState[playerIndex] == 0) {
gambleChoose(msg,allPlayers[playerIndex],playerIndex);
playerState[playerIndex]+=1;
int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
for (int i=0; i < allPlayers[playerIndex].handCardsNum; i++) playerHandCard[i]=allPlayers[playerIndex].handCards[i];
result=GodHelper.toChooseGamble("String_Node_Str",playerHandCard);
}
 else if (playerState[playerIndex] == 1) {
winJudge();
for (int i=0; i < playerNum; i++) {
  if (allPlayers[i].isWin)   playerWinList[i]=1;
}
playerState[playerIndex]=0;
phaseState=PhaseState.ACTION;
result=GodHelper.toWinJudge("String_Node_Str",gambleChoices,cardNumList,playerWinList,fireList);
}
break;
case ACTION:
if (playerState[playerIndex] == 0) {
depositAccount();
result=GodHelper.toDepositAccount("String_Node_Str",energyList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 1) {
skillsAccount();
result=GodHelper.toSkillsAccount("String_Node_Str");
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 2) {
fireAccount();
result=GodHelper.toFireAccount("String_Node_Str",healthPointList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 3) {
moveAccount();
result=GodHelper.toMoveAccount("String_Node_Str",locationList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 4) {
elemAccount();
result=GodHelper.toElemAccount("String_Node_Str",elementList);
playerState[playerIndex]+=1;
}
 else if (playerState[playerIndex] == 5) {
humanVictory();
if (humanWin) {
result=GodHelper.toHumanVictory("String_Node_Str");
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else {
result=GodHelper.toHumanVictory("String_Node_Str");
playerState[playerIndex]+=1;
}
}
 else if (playerState[playerIndex] == 6) {
infectionAccount();
if (zombieWin) {
result=GodHelper.toInfectionAccount("String_Node_Str",teamList);
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else {
result=GodHelper.toInfectionAccount("String_Node_Str",teamList);
playerState[playerIndex]+=1;
}
}
 else if (playerState[playerIndex] == 7) {
desertAccount(playerIndex,msg);
int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
for (int i=0; i < allPlayers[playerIndex].handCardsNum; i++) playerHandCard[i]=allPlayers[playerIndex].handCards[i];
result=GodHelper.toDesertAccount("String_Node_Str",allPlayers[playerIndex].energy,playerHandCard);
phaseState=PhaseState.PREPARE;
playerState[playerIndex]=0;
seen_card_count=0;
gamble_count=0;
desert_count=0;
for (int i=0; i < playerNum; i++) {
allPlayers[i].stratDecision=GambleChecker.DEPOSIT;
allPlayers[i].fireTarget=-1;
allPlayers[i].moveDirection=-1;
availableFireTarget[i]=-1;
availableMoveDirection[i]=-1;
decisionChoices[i]=GambleChecker.DEPOSIT;
seenCardChoices[i]=0;
gambleChoices[i]=GambleChecker.PAPER;
cardNumList[i]=0;
playerWinList[i]=0;
fireList[i]=-1;
}
}
break;
}
break;
case END:
result=GodHelper.toGameOver("String_Node_Str",scoreList);
break;
}
if (result.equals("String_Node_Str")) {
System.out.printf("String_Node_Str",sid,msg,gameState.toString());
}
return result;
}