Skip to content
Snippets Groups Projects
Commit 17d3b8c2 authored by iliya's avatar iliya
Browse files

feat: initially sorting a hand by the rank value between two cards, if the...

feat: initially sorting a hand by the rank value between two cards, if the diff is non-zero, then sorting by ordering of enums
parent 725366c8
No related branches found
No related tags found
No related merge requests found
...@@ -184,8 +184,12 @@ public class Deck { ...@@ -184,8 +184,12 @@ public class Deck {
int lhs = Arrays.asList(Card.getRANK_NAMES()).indexOf(name1[0]); int lhs = Arrays.asList(Card.getRANK_NAMES()).indexOf(name1[0]);
int rhs = Arrays.asList(Card.getRANK_NAMES()).indexOf(name2[0]); int rhs = Arrays.asList(Card.getRANK_NAMES()).indexOf(name2[0]);
int diff_rank = lhs - rhs;
return lhs - rhs; if (diff_rank != 0) {
return diff_rank;
}
return o1.getSuit().compareTo(o2.getSuit());
} }
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment