Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static boolean isStraight(String[] _cards)
- {
- FastList<String> tempCards = new FastList<String>();
- FastList<String> temp = new FastList<String>();
- //remove duplicates
- for (int i = 0; i < _cards.length; i++)
- {
- if (temp.contains(_cards[i].substring(1)))
- continue;
- temp.add(_cards[i].substring(1));
- tempCards.add(_cards[i]);
- }
- //check if without duplicate the list size at least is 5 or else it cant be flush
- if (tempCards.size() < 5)
- return false;
- for (int i = 0 ; i < tempCards.size(); i++)
- System.out.println(tempCards.get(i));
- //arrange cards from big to small
- System.out.println("organized to");
- Object[] tryer = tempCards.toArray();
- for ( int i = 0 ; i < tryer.length; i++ )
- {
- for (int x = i +1 ; x < tryer.length ; x++)
- {
- if (Integer.parseInt(String.valueOf(tryer[i]).substring(1)) < Integer.parseInt(String.valueOf(tryer[x]).substring(1)))
- {
- String temp2 = String.valueOf(tryer[i]);
- tryer[i] = tryer[x];
- tryer[x] = temp2;
- }
- }
- }
- for (int i = 0 ; i < tryer.length; i++)
- System.out.println(tryer[i]);
- //check if straight then return true and send the heights card rank of the straight(not yet)
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement