Original Post
Hi, I am making a card game (Poker) I have everything implemented up to the final sort. What I plan on doing is sorting the arrayList by numbers using substring, and then after the sort.Putting the suit into on array and the number into another. I was wondering the best way to go about this a bubble sort of some sort? Here is my psuedo code of sorts.
private void bubsort(){
// I have an array List defined
//private List<String> finalHand = new ArrayList<String>();
//Which contains the following
//{h9,c7,h13,h3,c2}
//hearts=h,clubs=c,d=diamonds,spades=s although no spades or c in this hand
I was wondering if I could bubble sort this using a substring(?,?)so I would sort the cards on only the numbers.
Then when I break it into two arrays would be
array1=[c,h,c,h,h]
array2=[2,3,7,9,13]
This makes is easy to check for flushes and straights etc....
Hope that makes sense. I know the basic theory to do this I think, Btw I am coming over to java from actionscript. Thanks