@Test public void testCheckPokerType1() { pokers.clear(); Assert.assertNull(PokerHelper.checkPokerType(pokers).getSellPokers()); Assert.assertEquals(-1,PokerHelper.checkPokerType(pokers).getScore()); Assert.assertEquals(SellType.ILLEGAL,PokerHelper.checkPokerType(pokers).getSellType()); pokers.add(new Poker(PokerLevel.LEVEL_SMALL_KING, PokerType.BLANK)); pokers.add(new Poker(PokerLevel.LEVEL_BIG_KING, PokerType.DIAMOND)); Assert.assertEquals(pokers,PokerHelper.checkPokerType(pokers).getSellPokers()); Assert.assertEquals(2147483647,PokerHelper.checkPokerType(pokers).getScore()); Assert.assertEquals(SellType.KING_BOMB,PokerHelper.checkPokerType(pokers).getSellType()); }
public static PokerSell checkPokerType(List<Poker> pokers) { if(pokers != null && ! pokers.isEmpty()) { sortPoker(pokers); int[] levelTable = new int[20]; for(Poker poker: pokers) { levelTable[poker.getLevel().getLevel()] ++; } int startIndex = -1; int endIndex = -1; int count = 0; int singleCount = 0; int doubleCount = 0; int threeCount = 0; int threeStartIndex = -1; int threeEndIndex = -1; int fourCount = 0; int fourStartIndex = -1; int fourEndIndex = -1; for(int index = 0; index < levelTable.length; index ++) { int value = levelTable[index]; if(value != 0) { endIndex = index; count ++; if(startIndex == -1) { startIndex = index; } if(value == 1) { singleCount ++; }else if(value == 2) { doubleCount ++; }else if(value == 3) { if(threeStartIndex == -1) { threeStartIndex = index; } threeEndIndex = index; threeCount ++; }else if(value == 4) { if(fourStartIndex == -1) { fourStartIndex = index; } fourEndIndex = index; fourCount ++; } } } if(singleCount == doubleCount && singleCount == threeCount && singleCount == 0 && fourCount == 1) { return new PokerSell(SellType.BOMB, pokers, startIndex); } if(singleCount == 2 && startIndex == PokerLevel.LEVEL_SMALL_KING.getLevel() && endIndex == PokerLevel.LEVEL_BIG_KING.getLevel()) { return new PokerSell(SellType.KING_BOMB, pokers, PokerLevel.LEVEL_SMALL_KING.getLevel()); } if(startIndex == endIndex) { if(levelTable[startIndex] == 1) { return new PokerSell(SellType.SINGLE, pokers, startIndex); }else if(levelTable[startIndex] == 2) { return new PokerSell(SellType.DOUBLE, pokers, startIndex); }else if(levelTable[startIndex] == 3) { return new PokerSell(SellType.THREE, pokers, startIndex); } } if(endIndex - startIndex == count - 1 && endIndex < PokerLevel.LEVEL_2.getLevel()) { if(levelTable[startIndex] == 1 && singleCount > 4 && doubleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.SINGLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 2 && doubleCount > 2 && singleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.DOUBLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 3 && threeCount > 1 && doubleCount + singleCount + fourCount == 0) { return new PokerSell(SellType.THREE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 4 && fourCount > 1 && doubleCount + threeCount + singleCount == 0) { return new PokerSell(SellType.FOUR_STRAIGHT, pokers, endIndex); } } if(threeCount != 0) { if(singleCount != 0 && singleCount == threeCount && doubleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_SINGLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.THREE_STRAIGHT_WITH_SINGLE, pokers, threeEndIndex); } } }else if(doubleCount != 0 && doubleCount == threeCount && singleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_DOUBLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, threeEndIndex); } } } } if(fourCount != 0) { if(singleCount != 0 && singleCount == fourCount * 2 && doubleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_SINGLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_SINGLE, pokers, fourEndIndex); } } }else if(doubleCount != 0 && doubleCount == fourCount * 2 && singleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_DOUBLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, fourEndIndex); } } } } } return new PokerSell(SellType.ILLEGAL, null, -1); }
PokerHelper { public static PokerSell checkPokerType(List<Poker> pokers) { if(pokers != null && ! pokers.isEmpty()) { sortPoker(pokers); int[] levelTable = new int[20]; for(Poker poker: pokers) { levelTable[poker.getLevel().getLevel()] ++; } int startIndex = -1; int endIndex = -1; int count = 0; int singleCount = 0; int doubleCount = 0; int threeCount = 0; int threeStartIndex = -1; int threeEndIndex = -1; int fourCount = 0; int fourStartIndex = -1; int fourEndIndex = -1; for(int index = 0; index < levelTable.length; index ++) { int value = levelTable[index]; if(value != 0) { endIndex = index; count ++; if(startIndex == -1) { startIndex = index; } if(value == 1) { singleCount ++; }else if(value == 2) { doubleCount ++; }else if(value == 3) { if(threeStartIndex == -1) { threeStartIndex = index; } threeEndIndex = index; threeCount ++; }else if(value == 4) { if(fourStartIndex == -1) { fourStartIndex = index; } fourEndIndex = index; fourCount ++; } } } if(singleCount == doubleCount && singleCount == threeCount && singleCount == 0 && fourCount == 1) { return new PokerSell(SellType.BOMB, pokers, startIndex); } if(singleCount == 2 && startIndex == PokerLevel.LEVEL_SMALL_KING.getLevel() && endIndex == PokerLevel.LEVEL_BIG_KING.getLevel()) { return new PokerSell(SellType.KING_BOMB, pokers, PokerLevel.LEVEL_SMALL_KING.getLevel()); } if(startIndex == endIndex) { if(levelTable[startIndex] == 1) { return new PokerSell(SellType.SINGLE, pokers, startIndex); }else if(levelTable[startIndex] == 2) { return new PokerSell(SellType.DOUBLE, pokers, startIndex); }else if(levelTable[startIndex] == 3) { return new PokerSell(SellType.THREE, pokers, startIndex); } } if(endIndex - startIndex == count - 1 && endIndex < PokerLevel.LEVEL_2.getLevel()) { if(levelTable[startIndex] == 1 && singleCount > 4 && doubleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.SINGLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 2 && doubleCount > 2 && singleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.DOUBLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 3 && threeCount > 1 && doubleCount + singleCount + fourCount == 0) { return new PokerSell(SellType.THREE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 4 && fourCount > 1 && doubleCount + threeCount + singleCount == 0) { return new PokerSell(SellType.FOUR_STRAIGHT, pokers, endIndex); } } if(threeCount != 0) { if(singleCount != 0 && singleCount == threeCount && doubleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_SINGLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.THREE_STRAIGHT_WITH_SINGLE, pokers, threeEndIndex); } } }else if(doubleCount != 0 && doubleCount == threeCount && singleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_DOUBLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, threeEndIndex); } } } } if(fourCount != 0) { if(singleCount != 0 && singleCount == fourCount * 2 && doubleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_SINGLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_SINGLE, pokers, fourEndIndex); } } }else if(doubleCount != 0 && doubleCount == fourCount * 2 && singleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_DOUBLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, fourEndIndex); } } } } } return new PokerSell(SellType.ILLEGAL, null, -1); } }
PokerHelper { public static PokerSell checkPokerType(List<Poker> pokers) { if(pokers != null && ! pokers.isEmpty()) { sortPoker(pokers); int[] levelTable = new int[20]; for(Poker poker: pokers) { levelTable[poker.getLevel().getLevel()] ++; } int startIndex = -1; int endIndex = -1; int count = 0; int singleCount = 0; int doubleCount = 0; int threeCount = 0; int threeStartIndex = -1; int threeEndIndex = -1; int fourCount = 0; int fourStartIndex = -1; int fourEndIndex = -1; for(int index = 0; index < levelTable.length; index ++) { int value = levelTable[index]; if(value != 0) { endIndex = index; count ++; if(startIndex == -1) { startIndex = index; } if(value == 1) { singleCount ++; }else if(value == 2) { doubleCount ++; }else if(value == 3) { if(threeStartIndex == -1) { threeStartIndex = index; } threeEndIndex = index; threeCount ++; }else if(value == 4) { if(fourStartIndex == -1) { fourStartIndex = index; } fourEndIndex = index; fourCount ++; } } } if(singleCount == doubleCount && singleCount == threeCount && singleCount == 0 && fourCount == 1) { return new PokerSell(SellType.BOMB, pokers, startIndex); } if(singleCount == 2 && startIndex == PokerLevel.LEVEL_SMALL_KING.getLevel() && endIndex == PokerLevel.LEVEL_BIG_KING.getLevel()) { return new PokerSell(SellType.KING_BOMB, pokers, PokerLevel.LEVEL_SMALL_KING.getLevel()); } if(startIndex == endIndex) { if(levelTable[startIndex] == 1) { return new PokerSell(SellType.SINGLE, pokers, startIndex); }else if(levelTable[startIndex] == 2) { return new PokerSell(SellType.DOUBLE, pokers, startIndex); }else if(levelTable[startIndex] == 3) { return new PokerSell(SellType.THREE, pokers, startIndex); } } if(endIndex - startIndex == count - 1 && endIndex < PokerLevel.LEVEL_2.getLevel()) { if(levelTable[startIndex] == 1 && singleCount > 4 && doubleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.SINGLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 2 && doubleCount > 2 && singleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.DOUBLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 3 && threeCount > 1 && doubleCount + singleCount + fourCount == 0) { return new PokerSell(SellType.THREE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 4 && fourCount > 1 && doubleCount + threeCount + singleCount == 0) { return new PokerSell(SellType.FOUR_STRAIGHT, pokers, endIndex); } } if(threeCount != 0) { if(singleCount != 0 && singleCount == threeCount && doubleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_SINGLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.THREE_STRAIGHT_WITH_SINGLE, pokers, threeEndIndex); } } }else if(doubleCount != 0 && doubleCount == threeCount && singleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_DOUBLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, threeEndIndex); } } } } if(fourCount != 0) { if(singleCount != 0 && singleCount == fourCount * 2 && doubleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_SINGLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_SINGLE, pokers, fourEndIndex); } } }else if(doubleCount != 0 && doubleCount == fourCount * 2 && singleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_DOUBLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, fourEndIndex); } } } } } return new PokerSell(SellType.ILLEGAL, null, -1); }  }
PokerHelper { public static PokerSell checkPokerType(List<Poker> pokers) { if(pokers != null && ! pokers.isEmpty()) { sortPoker(pokers); int[] levelTable = new int[20]; for(Poker poker: pokers) { levelTable[poker.getLevel().getLevel()] ++; } int startIndex = -1; int endIndex = -1; int count = 0; int singleCount = 0; int doubleCount = 0; int threeCount = 0; int threeStartIndex = -1; int threeEndIndex = -1; int fourCount = 0; int fourStartIndex = -1; int fourEndIndex = -1; for(int index = 0; index < levelTable.length; index ++) { int value = levelTable[index]; if(value != 0) { endIndex = index; count ++; if(startIndex == -1) { startIndex = index; } if(value == 1) { singleCount ++; }else if(value == 2) { doubleCount ++; }else if(value == 3) { if(threeStartIndex == -1) { threeStartIndex = index; } threeEndIndex = index; threeCount ++; }else if(value == 4) { if(fourStartIndex == -1) { fourStartIndex = index; } fourEndIndex = index; fourCount ++; } } } if(singleCount == doubleCount && singleCount == threeCount && singleCount == 0 && fourCount == 1) { return new PokerSell(SellType.BOMB, pokers, startIndex); } if(singleCount == 2 && startIndex == PokerLevel.LEVEL_SMALL_KING.getLevel() && endIndex == PokerLevel.LEVEL_BIG_KING.getLevel()) { return new PokerSell(SellType.KING_BOMB, pokers, PokerLevel.LEVEL_SMALL_KING.getLevel()); } if(startIndex == endIndex) { if(levelTable[startIndex] == 1) { return new PokerSell(SellType.SINGLE, pokers, startIndex); }else if(levelTable[startIndex] == 2) { return new PokerSell(SellType.DOUBLE, pokers, startIndex); }else if(levelTable[startIndex] == 3) { return new PokerSell(SellType.THREE, pokers, startIndex); } } if(endIndex - startIndex == count - 1 && endIndex < PokerLevel.LEVEL_2.getLevel()) { if(levelTable[startIndex] == 1 && singleCount > 4 && doubleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.SINGLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 2 && doubleCount > 2 && singleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.DOUBLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 3 && threeCount > 1 && doubleCount + singleCount + fourCount == 0) { return new PokerSell(SellType.THREE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 4 && fourCount > 1 && doubleCount + threeCount + singleCount == 0) { return new PokerSell(SellType.FOUR_STRAIGHT, pokers, endIndex); } } if(threeCount != 0) { if(singleCount != 0 && singleCount == threeCount && doubleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_SINGLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.THREE_STRAIGHT_WITH_SINGLE, pokers, threeEndIndex); } } }else if(doubleCount != 0 && doubleCount == threeCount && singleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_DOUBLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, threeEndIndex); } } } } if(fourCount != 0) { if(singleCount != 0 && singleCount == fourCount * 2 && doubleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_SINGLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_SINGLE, pokers, fourEndIndex); } } }else if(doubleCount != 0 && doubleCount == fourCount * 2 && singleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_DOUBLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, fourEndIndex); } } } } } return new PokerSell(SellType.ILLEGAL, null, -1); }  static void sortPoker(List<Poker> pokers); static int[] getIndexes(Character[] options, List<Poker> pokers); static boolean checkPokerIndex(int[] indexes, List<Poker> pokers); static PokerSell checkPokerType(List<Poker> pokers); static int parseScore(SellType sellType, int level); static List<Poker> getPoker(int[] indexes, List<Poker> pokers); static boolean comparePoker(List<Poker> pres, List<Poker> currents); static List<List<Poker>> distributePoker(); static String printPoker(List<Poker> pokers); static String textOnlyNoType(List<Poker> pokers); static int parsePokerColligationScore(List<Poker> pokers); static List<PokerSell> parsePokerSells(List<Poker> pokers); }
PokerHelper { public static PokerSell checkPokerType(List<Poker> pokers) { if(pokers != null && ! pokers.isEmpty()) { sortPoker(pokers); int[] levelTable = new int[20]; for(Poker poker: pokers) { levelTable[poker.getLevel().getLevel()] ++; } int startIndex = -1; int endIndex = -1; int count = 0; int singleCount = 0; int doubleCount = 0; int threeCount = 0; int threeStartIndex = -1; int threeEndIndex = -1; int fourCount = 0; int fourStartIndex = -1; int fourEndIndex = -1; for(int index = 0; index < levelTable.length; index ++) { int value = levelTable[index]; if(value != 0) { endIndex = index; count ++; if(startIndex == -1) { startIndex = index; } if(value == 1) { singleCount ++; }else if(value == 2) { doubleCount ++; }else if(value == 3) { if(threeStartIndex == -1) { threeStartIndex = index; } threeEndIndex = index; threeCount ++; }else if(value == 4) { if(fourStartIndex == -1) { fourStartIndex = index; } fourEndIndex = index; fourCount ++; } } } if(singleCount == doubleCount && singleCount == threeCount && singleCount == 0 && fourCount == 1) { return new PokerSell(SellType.BOMB, pokers, startIndex); } if(singleCount == 2 && startIndex == PokerLevel.LEVEL_SMALL_KING.getLevel() && endIndex == PokerLevel.LEVEL_BIG_KING.getLevel()) { return new PokerSell(SellType.KING_BOMB, pokers, PokerLevel.LEVEL_SMALL_KING.getLevel()); } if(startIndex == endIndex) { if(levelTable[startIndex] == 1) { return new PokerSell(SellType.SINGLE, pokers, startIndex); }else if(levelTable[startIndex] == 2) { return new PokerSell(SellType.DOUBLE, pokers, startIndex); }else if(levelTable[startIndex] == 3) { return new PokerSell(SellType.THREE, pokers, startIndex); } } if(endIndex - startIndex == count - 1 && endIndex < PokerLevel.LEVEL_2.getLevel()) { if(levelTable[startIndex] == 1 && singleCount > 4 && doubleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.SINGLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 2 && doubleCount > 2 && singleCount + threeCount + fourCount == 0) { return new PokerSell(SellType.DOUBLE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 3 && threeCount > 1 && doubleCount + singleCount + fourCount == 0) { return new PokerSell(SellType.THREE_STRAIGHT, pokers, endIndex); }else if(levelTable[startIndex] == 4 && fourCount > 1 && doubleCount + threeCount + singleCount == 0) { return new PokerSell(SellType.FOUR_STRAIGHT, pokers, endIndex); } } if(threeCount != 0) { if(singleCount != 0 && singleCount == threeCount && doubleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_SINGLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.THREE_STRAIGHT_WITH_SINGLE, pokers, threeEndIndex); } } }else if(doubleCount != 0 && doubleCount == threeCount && singleCount == 0 && fourCount == 0) { if(threeCount == 1) { return new PokerSell(SellType.THREE_ZONES_DOUBLE, pokers, threeEndIndex); }else { if(threeEndIndex - threeStartIndex + 1 == threeCount && threeEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, threeEndIndex); } } } } if(fourCount != 0) { if(singleCount != 0 && singleCount == fourCount * 2 && doubleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_SINGLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_SINGLE, pokers, fourEndIndex); } } }else if(doubleCount != 0 && doubleCount == fourCount * 2 && singleCount == 0 && threeCount == 0) { if(fourCount == 1) { return new PokerSell(SellType.FOUR_ZONES_DOUBLE, pokers, fourEndIndex); }else { if(fourEndIndex - fourStartIndex + 1 == fourCount && fourEndIndex < PokerLevel.LEVEL_2.getLevel()) { return new PokerSell(SellType.FOUR_STRAIGHT_WITH_DOUBLE, pokers, fourEndIndex); } } } } } return new PokerSell(SellType.ILLEGAL, null, -1); }  static void sortPoker(List<Poker> pokers); static int[] getIndexes(Character[] options, List<Poker> pokers); static boolean checkPokerIndex(int[] indexes, List<Poker> pokers); static PokerSell checkPokerType(List<Poker> pokers); static int parseScore(SellType sellType, int level); static List<Poker> getPoker(int[] indexes, List<Poker> pokers); static boolean comparePoker(List<Poker> pres, List<Poker> currents); static List<List<Poker>> distributePoker(); static String printPoker(List<Poker> pokers); static String textOnlyNoType(List<Poker> pokers); static int parsePokerColligationScore(List<Poker> pokers); static List<PokerSell> parsePokerSells(List<Poker> pokers); static int pokerPrinterType; static int totalPrinters; }