Program: 72229
Project: 72229
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) {
    wait_count=0;
    if (allPlayers[playerIndex].handCardsNum + 4 <= allPlayers[playerIndex].healthPoint)     GambleChecker.cardDistribute(cardHeap,allPlayers[playerIndex],4);
 else     GambleChecker.cardDistribute(cardHeap,allPlayers[playerIndex],allPlayers[playerIndex].healthPoint - allPlayers[playerIndex].handCardsNum);
    int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
    seenCardJudge(playerIndex,playerHandCard);
    for (int i=0; i < playerNum; i++) {
      if (map.distance[allPlayers[playerIndex].preLoc][allPlayers[i].preLoc] < allPlayers[playerIndex].range)       availableFireTarget[i]=1;
    }
    int[] availableMoveDirection=map.units[allPlayers[playerIndex].preLoc].availableDir();
    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,allPlayers[playerIndex].handCards[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) {
String state;
if (humanWin) {
state="String_Node_Str";
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else if (zombieWin) {
state="String_Node_Str";
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else {
state="String_Node_Str";
playerState[playerIndex]+=1;
}
result=GodHelper.toAccount(state,energyList,healthPointList,locationList,elementList,teamList);
}
 else if (playerState[playerIndex] == 1) {
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);
waitAllPlayers(playerIndex);
}
break;
}
break;
case END:
for (int i=0; i < playerNum; i++) playerSID[i]=allPlayers[i].SID;
SessionController.endGame(playerSID,scoreList);
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) {
    wait_count=0;
    if (allPlayers[playerIndex].handCardsNum + 4 <= allPlayers[playerIndex].healthPoint)     GambleChecker.cardDistribute(cardHeap,allPlayers[playerIndex],4);
 else     GambleChecker.cardDistribute(cardHeap,allPlayers[playerIndex],allPlayers[playerIndex].healthPoint - allPlayers[playerIndex].handCardsNum);
    int[] playerHandCard=new int[allPlayers[playerIndex].handCardsNum];
    seenCardJudge(playerIndex,playerHandCard);
    for (int i=0; i < playerNum; i++) {
      if (map.distance[allPlayers[playerIndex].preLoc][allPlayers[i].preLoc] < allPlayers[playerIndex].range)       availableFireTarget[i]=1;
    }
    int[] availableMoveDirection=map.units[allPlayers[playerIndex].preLoc].availableDir();
    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,allPlayers[playerIndex].handCards[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) {
String state;
if (humanWin) {
state="String_Node_Str";
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else if (zombieWin) {
state="String_Node_Str";
playerState[playerIndex]=0;
gameState=GameState.END;
}
 else {
state="String_Node_Str";
playerState[playerIndex]+=1;
}
result=GodHelper.toAccount(state,energyList,healthPointList,locationList,elementList,teamList);
}
 else if (playerState[playerIndex] == 1) {
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);
waitAllPlayers(playerIndex);
}
break;
}
break;
case END:
int[] playerSID=new int[playerNum];
for (int i=0; i < playerNum; i++) playerSID[i]=allPlayers[i].SID;
SessionController.endGame(playerSID,scoreList);
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;
}