break;
}
}
public Board setNamesToBoard(PokerData pdata, Board board, List<String> names, ParserResult parserResult, boolean isFirstAuction) {
Player player;
boolean inAction = false;
String playerName = "";
String heroName = pdata.getProgramSettings().getHeroName();
boolean starts = false;
int dealer;
int position;
if (names == null)
return board;
if (isFirstAuction){
String SBName = parserResult.getPlayerBlinds().get(0).getName().trim();
String BBName = parserResult.getPlayerBlinds().get(1).getName().trim();
if (!BBName.equals(heroName)){
dealer = board.getDealer();
// storing required blinds names;
position= board.getNextInGamePlayer(dealer);
board.getPlayers().get(position).setName(SBName);
position= board.getNextInGamePlayer(position);
board.getPlayers().get(position).setName(BBName);
}else{
position= board.getHero();
board.getPlayers().get(position).setName(BBName);
// attempt to find the sb;
position = board.getDealer();
int tmp;
tmp = board.getNextActivePlayer(position);
if (tmp != board.getHero()){
board.getPlayers().get(tmp).setName(SBName);
}else{
tmp = board.getNextInGamePlayer(position);
if (board.getPlayers().get(tmp).getName().trim().equals(""))
board.getPlayers().get(tmp).setName(SBName);
}
position= board.getHero();
}
for (int i = 0; i < names.size(); i++){
inAction = names.get(i).startsWith("1") ? true : false;
if (!inAction) continue;
playerName = names.get(i).substring(1);
if (board.findPlayerOnBoardByName(playerName) != null)
break;
position = board.getNextActivePlayer(position);
player = board.getPlayers().get(position);
player.setName(playerName);
}
}
else{
position = board.getHero(); // hero position;
starts = false;
//heroName
for (int i = 0; i < names.size(); i++){
playerName = names.get(i).substring(1);
if (!starts){
if (playerName.equals(heroName)){
starts = true;
player = board.getPlayers().get(position);
player.setName(playerName);
position = board.getNextActivePlayer(position);
continue;
}else{
continue;
}
}
inAction = names.get(i).startsWith("1") ? true : false;
if (!inAction) continue;
if (board.findPlayerOnBoardByName(playerName) != null){
continue;
}
else{
player = board.getPlayers().get(position);
if (!player.getName().trim().equals("")) break;
player.setName(playerName);
position = board.getNextActivePlayer(position);
}
}
}